From 8efb7bc45c2a04af2e448f1f04d0d928edb17299 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Tue, 15 Oct 2024 18:32:00 +0200 Subject: [PATCH] small improevement in robustness --- .../bioimageio/description/ModelDescriptorV05.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorV05.java b/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorV05.java index 51cc9c30..34bcac9b 100644 --- a/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorV05.java +++ b/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorV05.java @@ -72,8 +72,6 @@ public class ModelDescriptorV05 implements ModelDescriptor private String localModelPath; private boolean supportBioengine = false; private Map yamlElements; - - private static BioimageioRepo BMZ_REPO; protected ModelDescriptorV05(Map yamlElements) throws ModelSpecsException { @@ -185,6 +183,9 @@ protected void buildModelDescription() throws ModelSpecsException if (modelID == null) { modelID = findID(yamlElements); } + if (modelID.length() - modelID.replace("/", "").length() >= 2 + && modelID.substring(modelID.indexOf("/") + 1).indexOf("/") - modelID.indexOf("/") > 2 ) + modelID = modelID.substring(0, modelID.indexOf("/") + modelID.substring(modelID.indexOf("/") + 1).indexOf("/") + 1); addBioEngine(); if (localModelPath == null) return; @@ -689,12 +690,8 @@ public void addModelPath(Path modelBasePath) { @Override public String getModelURL() { - if (this.download_url == null && BMZ_REPO == null) { - BMZ_REPO = BioimageioRepo.connect(); - } - if (this.download_url == null) - this.download_url = BMZ_REPO.getModelRdfUrl(modelID, version); + this.download_url = BioimageioRepo.getModelRdfUrl(modelID, version); return this.download_url; }