Skip to content

Commit

Permalink
deal with the issue of the content suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Dec 17, 2023
1 parent 703bee3 commit 438d028
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/bioimage/modelrunner/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public static Model createBioimageioModel(String bmzModelFolder, String enginesF
List<WeightFormat> modelWeights = descriptor.getWeights().gettAllSupportedWeightObjects();
EngineInfo info = null;
for (WeightFormat ww : modelWeights) {
String source = ww.getSource();
String source = ww.getSourceFileName();
if (!(new File(bmzModelFolder, source.substring(source.lastIndexOf("/")) )).isFile())
continue;
info = EngineInfo.defineCompatibleDLEngineWithRdfYamlWeights(ww, enginesFolder);
Expand Down Expand Up @@ -349,7 +349,7 @@ public static Model createBioimageioModelWithExactWeigths(String bmzModelFolder,
List<WeightFormat> modelWeights = descriptor.getWeights().gettAllSupportedWeightObjects();
EngineInfo info = null;
for (WeightFormat ww : modelWeights) {
String source = ww.getSource();
String source = ww.getSourceFileName();
if (!(new File(bmzModelFolder, source.substring(source.lastIndexOf("/")) )).isFile())
continue;
info = EngineInfo.defineExactDLEngineWithRdfYamlWeights(ww, enginesFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class CommonUtils {
* @throws MalformedURLException if the String does not correspond to an URL
*/
public static String getFileNameFromURLString(String str) throws MalformedURLException {
if (str.startsWith(Constants.ZENODO_DOMAIN))
if (str.startsWith(Constants.ZENODO_DOMAIN) && str.endsWith(Constants.ZENODO_ANNOYING_SUFFIX))
str = str.substring(0, str.length() - Constants.ZENODO_ANNOYING_SUFFIX.length());
URL url = new URL(str);
return new File(url.getPath()).getName();
Expand Down

0 comments on commit 438d028

Please sign in to comment.