Skip to content

Commit

Permalink
allow both "jar:file:./my.jar!/" and "jar:file:./my.jar!" as LOAD_PAT…
Browse files Browse the repository at this point in the history
…H entries

this was a regression introduced with jruby-1.7.13 - fixes #2017

Sponsored by Lookout Inc.
  • Loading branch information
mkristian committed Nov 11, 2014
1 parent f4036ab commit 5b3c45b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/JarResource.java
Expand Up @@ -30,7 +30,8 @@ public static JarResource create(String pathname) {

int bang = sanitized.indexOf('!');
String jarPath = sanitized.substring(0, bang);
String entryPath = sanitized.substring(bang + 1);
// normalize path -- issue #2017
String entryPath = sanitized.substring(bang + 1).replace("//", "/");

// TODO: Do we really need to support both test.jar!foo/bar.rb and test.jar!/foo/bar.rb cases?
JarResource resource = createJarResource(jarPath, entryPath, false);
Expand Down
6 changes: 6 additions & 0 deletions test/test_jar_on_load_path.rb
Expand Up @@ -6,4 +6,10 @@ def test_jar_on_load_path
require 'test_jruby_1332.rb'
assert($jruby_1332)
end

def test_jar_on_load_path_with_trailing_slash
$LOAD_PATH << "test/test_jruby_1332.jar!/"
require 'test_jruby_1332.rb'
assert($jruby_1332)
end
end

0 comments on commit 5b3c45b

Please sign in to comment.