Fix jar file path detection if the path contains a "!" (#7790)

This commit is contained in:
Take Weiland authored and GitHub committed 2021-06-08 13:26:01 -07:00
1 parent 2a7dde3d2e
commit 84381553a9
1 file changed
+3 -2
@@ -54,8 +54,9 @@ public class LibraryFinder {
try {
Path path;
final URI uri = resource.toURI();
if (uri.getRawSchemeSpecificPart().contains("!")) {
path = Paths.get(new URI(uri.getRawSchemeSpecificPart().split("!")[0]));
if (uri.getScheme().equals("jar") && uri.getRawSchemeSpecificPart().contains("!/")) {
int lastExcl = uri.getRawSchemeSpecificPart().lastIndexOf("!/");
path = Paths.get(new URI(uri.getRawSchemeSpecificPart().substring(0, lastExcl)));
} else {
path = Paths.get(new URI("file://"+uri.getRawSchemeSpecificPart().substring(0, uri.getRawSchemeSpecificPart().length()-resourceName.length())));
}