Skip to content

Commit

Permalink
small improevement in robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 15, 2024
1 parent 11355f9 commit 8efb7bc
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public class ModelDescriptorV05 implements ModelDescriptor
private String localModelPath;
private boolean supportBioengine = false;
private Map<String, Object> yamlElements;

private static BioimageioRepo BMZ_REPO;

protected ModelDescriptorV05(Map<String, Object> yamlElements) throws ModelSpecsException
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 8efb7bc

Please sign in to comment.