diff --git a/api/src/main/java/ai/djl/repository/RepositoryFactoryImpl.java b/api/src/main/java/ai/djl/repository/RepositoryFactoryImpl.java index 71f394d6d14..a730a57cb54 100644 --- a/api/src/main/java/ai/djl/repository/RepositoryFactoryImpl.java +++ b/api/src/main/java/ai/djl/repository/RepositoryFactoryImpl.java @@ -160,11 +160,10 @@ public Repository newInstance(String name, URI uri) { Path path = Paths.get(parseFilePath(uri)); String fileName = path.toFile().getName(); - if (!FilenameUtils.isArchiveFile(fileName)) { - throw new IllegalArgumentException("Only archive file is supported for res URL."); + if (FilenameUtils.isArchiveFile(fileName)) { + fileName = FilenameUtils.getNamePart(fileName); } - fileName = FilenameUtils.getNamePart(fileName); return new JarRepository(name, uri, fileName, queryString); }