Skip to content

Commit

Permalink
Showing 3 changed files with 9 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
@@ -22,6 +22,8 @@ public static JarResource create(String pathname) {
try {
// since pathname is actually an uri we need to decode any url decoded characters like %20
// which happens when directory names contain spaces
// but do not to decode '+' to allow '+' inside a filenames
sanitized = sanitized.replace("+", "%2B");

This comment has been minimized.

Copy link
@mkristian

mkristian Feb 10, 2015

Author Member

@ratnikov do you have a better idea on how to decode in same cases and not to decode in other cases ?

This comment has been minimized.

Copy link
@ratnikov

ratnikov Feb 10, 2015

Contributor

Perhaps move the URI-fication logic to the createJarResource and try both with the value 'as' is and with a decoded value?

sanitized = URLDecoder.decode(sanitized, "UTF-8");
} catch (IllegalArgumentException iae) {
// something in the path did not decode, so it's probably not a URI
Binary file added test/jar_with+.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_load.rb
Original file line number Diff line number Diff line change
@@ -261,6 +261,13 @@ def test_loading_jar_with_leading_underscore
}
end

def test_jar_with_plus_in_name
assert_in_sub_runtime %{
require 'test/jar_with+.jar'
Dir['test/jar_with+.jar!/*'].size == 2
}
end

# JRUBY-5045
def test_cwd_plus_dotdot_jar_loading
assert_equal "hi", run_in_sub_runtime(%{

0 comments on commit d220103

Please sign in to comment.