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 56f9a24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/JarResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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
if (entryPath.startsWith("//")) entryPath = entryPath.substring(1);

// 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
Original file line number Diff line number Diff line change
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 56f9a24

Please sign in to comment.