@@ -19,20 +19,6 @@ public static JarResource create(String pathname) {
1919 Matcher matcher = PREFIX_MATCH .matcher (pathname );
2020 String sanitized = matcher .matches () ? matcher .group (1 ) : pathname ;
2121
22- try {
23- // since pathname is actually an uri we need to decode any url decoded characters like %20
24- // which happens when directory names contain spaces
25- // but do not to decode '+' to allow '+' inside a filenames
26- sanitized = sanitized .replace ("+" , "%2B" );
27- sanitized = URLDecoder .decode (sanitized , "UTF-8" );
28- } catch (IllegalArgumentException iae ) {
29- // something in the path did not decode, so it's probably not a URI
30- // See jruby/jruby#2264.
31- return null ;
32- } catch (UnsupportedEncodingException e ) {
33- throw new RuntimeException ( "hmm - system does not know UTF-8 string encoding :(" );
34- }
35-
3622 int bang = sanitized .indexOf ('!' );
3723 String jarPath = sanitized .substring (0 , bang );
3824 String entryPath = sanitized .substring (bang + 1 );
@@ -54,7 +40,22 @@ private static JarResource createJarResource(String jarPath, String entryPath, b
5440
5541 if (index == null ) {
5642 // Jar doesn't exist
57- return null ;
43+ try {
44+ jarPath = URLDecoder .decode (jarPath , "UTF-8" );
45+ entryPath = URLDecoder .decode (entryPath , "UTF-8" );
46+ } catch (IllegalArgumentException iae ) {
47+ // something in the path did not decode, so it's probably not a URI
48+ // See jruby/jruby#2264.
49+ return null ;
50+ } catch (UnsupportedEncodingException e ) {
51+ throw new RuntimeException ( "hmm - system does not know UTF-8 string encoding :(" );
52+ }
53+ index = jarCache .getIndex (jarPath );
54+
55+ if (index == null ) {
56+ // Jar doesn't exist
57+ return null ;
58+ }
5859 }
5960
6061 // Try it as directory first, because jars tend to have foo/ entries
0 commit comments