ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gin...@apache.org
Subject ant-ivy git commit: IVY-1573 do not skip versions with URL encoded characters
Date Tue, 30 Jan 2018 14:07:12 GMT
Repository: ant-ivy
Updated Branches:
  refs/heads/master 18b4d2402 -> 68e0a9c71


IVY-1573 do not skip versions with URL encoded characters

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/68e0a9c7
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/68e0a9c7
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/68e0a9c7

Branch: refs/heads/master
Commit: 68e0a9c71443738b1842e99925d37bf545f5a151
Parents: 18b4d24
Author: Gintas Grigelionis <gintas@apache.org>
Authored: Tue Jan 30 15:05:24 2018 +0100
Committer: Gintas Grigelionis <gintas@apache.org>
Committed: Tue Jan 30 15:06:58 2018 +0100

----------------------------------------------------------------------
 .../org/apache/ivy/util/url/ApacheURLLister.java  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/68e0a9c7/src/java/org/apache/ivy/util/url/ApacheURLLister.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/ApacheURLLister.java b/src/java/org/apache/ivy/util/url/ApacheURLLister.java
index fed36bb..c275e09 100644
--- a/src/java/org/apache/ivy/util/url/ApacheURLLister.java
+++ b/src/java/org/apache/ivy/util/url/ApacheURLLister.java
@@ -21,6 +21,8 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -140,19 +142,21 @@ public class ApacheURLLister {
 
             text = text.trim();
 
-            // handle complete URL listings
-            if (href.startsWith("http:") || href.startsWith("https:")) {
-                try {
-                    href = new URL(href).getPath();
+            try {
+                // URI methods decode the URL
+                URI uri = new URI(href);
+                href = uri.getPath();
+                // handle complete URL listings
+                if (uri.getScheme() != null) {
                     if (!href.startsWith(url.getPath())) {
                         // ignore URLs which aren't children of the base URL
                         continue;
                     }
                     href = href.substring(url.getPath().length());
-                } catch (Exception ignore) {
-                    // incorrect URL, ignore
-                    continue;
                 }
+            } catch (URISyntaxException e) {
+                // incorrect URL, ignore
+                continue;
             }
 
             if (href.startsWith("../")) {


Mime
View raw message