karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [karaf] branch karaf-4.1.x updated: [KARAF-5694]don't strip out protocol header
Date Thu, 26 Apr 2018 03:41:32 GMT
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
     new 2711223  [KARAF-5694]don't strip out protocol header
2711223 is described below

commit 2711223555f16ebfffcabd941175bb1212841645
Author: Freeman Fang <freeman.fang@gmail.com>
AuthorDate: Thu Apr 26 11:36:03 2018 +0800

    [KARAF-5694]don't strip out protocol header
    
    (cherry picked from commit 9fb700697e494b8310cff575f2a7b3ead3e21751)
---
 .../features/internal/download/impl/DownloadManagerHelper.java    | 8 ++++++++
 .../karaf/features/internal/download/impl/SimpleDownloadTask.java | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/DownloadManagerHelper.java
b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/DownloadManagerHelper.java
index fb5e4dd..ba2ffed 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/DownloadManagerHelper.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/DownloadManagerHelper.java
@@ -55,6 +55,14 @@ public final class DownloadManagerHelper {
         }
         return strippedUrl;
     }
+    
+    public static String stripStartLevel(String url) {
+        String strippedUrl = url;
+        if (strippedUrl.contains(";start-level=")) {
+            strippedUrl = strippedUrl.substring(0, strippedUrl.indexOf(";start-level="));
+        }
+        return strippedUrl;
+    }
 
     public static String stripInlinedMavenRepositoryUrl(String url) {
         if (url.startsWith("mvn:") && url.contains("!")) {
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
index 633bf23..b4e788a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
@@ -73,7 +73,7 @@ public class SimpleDownloadTask extends AbstractRetryableDownloadTask {
 
             File tmpFile = File.createTempFile("download-", null, dir);
             
-            urlObj = new URL(DownloadManagerHelper.stripUrl(urlObj.toString()));
+            urlObj = new URL(DownloadManagerHelper.stripStartLevel(urlObj.toString()));
             try (InputStream is = urlObj.openStream();
                  OutputStream os = new FileOutputStream(tmpFile)) {
                 StreamUtils.copy(is, os);

-- 
To stop receiving notification emails like this one, please contact
ffang@apache.org.

Mime
View raw message