Created
November 22, 2013 22:32
-
-
Save marktriggs/7608007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 12b3f8764cddf147ed774078add9dd544832e685 Mon Sep 17 00:00:00 2001 | |
From: Mark Triggs <mark@dishevelled.net> | |
Date: Sat, 23 Nov 2013 09:27:48 +1100 | |
Subject: [PATCH] Modify LoadService.splitJarUrl to unescape URLs | |
Resolves the issue with loading 'yaml' described in #1248 | |
--- | |
.../main/java/org/jruby/runtime/load/LoadService.java | 16 ++++++++++++---- | |
1 file changed, 12 insertions(+), 4 deletions(-) | |
diff --git a/core/src/main/java/org/jruby/runtime/load/LoadService.java b/core/src/main/java/org/jruby/runtime/load/LoadService.java | |
index a3c02f2..4235b59 100644 | |
--- a/core/src/main/java/org/jruby/runtime/load/LoadService.java | |
+++ b/core/src/main/java/org/jruby/runtime/load/LoadService.java | |
@@ -1392,13 +1392,21 @@ public class LoadService { | |
} | |
private String[] splitJarUrl(String loadPathEntry) { | |
- int idx = loadPathEntry.indexOf("!"); | |
+ String unescaped = loadPathEntry; | |
+ | |
+ try { | |
+ unescaped = new URI(loadPathEntry).getSchemeSpecificPart(); | |
+ } catch (URISyntaxException e) { | |
+ // Fall back to using the original string | |
+ } | |
+ | |
+ int idx = unescaped.indexOf("!"); | |
if (idx == -1) { | |
- return new String[]{loadPathEntry, ""}; | |
+ return new String[]{unescaped, ""}; | |
} | |
- String filename = loadPathEntry.substring(0, idx); | |
- String entry = idx + 2 < loadPathEntry.length() ? loadPathEntry.substring(idx + 2) : ""; | |
+ String filename = unescaped.substring(0, idx); | |
+ String entry = idx + 2 < unescaped.length() ? unescaped.substring(idx + 2) : ""; | |
if(filename.startsWith("jar:")) { | |
filename = filename.substring(4); | |
-- | |
1.7.10.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment