Skip to content

Commit f0aaf44

Browse files
committed
If presumed URI does not decode, it's not a URI. Fixes #2264.
1 parent 329bad2 commit f0aaf44

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/java/org/jruby/util/JarResource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public static JarResource create(String pathname) {
2424
// since pathname is actually an uri we need to decode any url decoded characters like %20
2525
// which happens when directory names contain spaces
2626
sanitized = URLDecoder.decode(sanitized, "UTF-8");
27+
} catch (IllegalArgumentException iae) {
28+
// something in the path did not decode, so it's probably not a URI
29+
// See jruby/jruby#2264.
30+
return null;
2731
} catch (UnsupportedEncodingException e) {
2832
throw new RuntimeException( "hmm - system does not know UTF-8 string encoding :(" );
2933
}

0 commit comments

Comments
 (0)