File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
stack-clients/src/main/java/com/cmclinnovations/stack/clients/utils Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -119,12 +119,13 @@ private static Set<URI> listFilesFromJar(URL dirURL) throws IOException {
119119 }
120120 }
121121 String cleanedDirURL = dirURL .toString ().replaceFirst ("^(.*?)/?$" , "$1/" );
122+ Path basePath = Path .of (path ).normalize ();
122123 try (JarFile jar = new JarFile (jarPath )) {
123124 Enumeration <JarEntry > entries = jar .entries (); // gives ALL entries in jar
124125 while (entries .hasMoreElements ()) {
125- String name = entries .nextElement ().getName ();
126- if (name .startsWith (path )) { // filter according to the path
127- String entry = name . substring ( path . length () );
126+ Path name = Path . of ( entries .nextElement ().getName ()). normalize ();
127+ if (name .startsWith (basePath )) { // filter according to the path
128+ String entry = basePath . relativize ( name ). toString ( );
128129 if (!entry .isEmpty () && !entry .contains ("/" )) {
129130 uris .add (URI .create (cleanedDirURL + entry ));
130131 }
You can’t perform that action at this time.
0 commit comments