archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sk...@apache.org
Subject archiva git commit: MRM-1848 lazy fix for tar.gz
Date Tue, 18 Nov 2014 23:22:30 GMT
Repository: archiva
Updated Branches:
  refs/heads/master 2b50f4836 -> a1d241470


MRM-1848 lazy fix for tar.gz 

Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/a1d24147
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/a1d24147
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/a1d24147

Branch: refs/heads/master
Commit: a1d2414702b9b497b8125bae0dc5e4cb516473da
Parents: 2b50f48
Author: Eric Barboni <skygo@apache.org>
Authored: Wed Nov 19 00:10:53 2014 +0100
Committer: Eric Barboni <skygo@apache.org>
Committed: Wed Nov 19 00:10:53 2014 +0100

----------------------------------------------------------------------
 .../rest/services/utils/ArtifactBuilder.java    | 26 +++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/a1d24147/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java
b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java
index 073a34a..423d27a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactBuilder.java
@@ -59,6 +59,25 @@ public class ArtifactBuilder
         return this;
     }
 
+    /**
+     * 
+     * @param filename
+     * @return 
+     */
+    private static String specialExtensions( String filename ) 
+    {
+        String[] special = {
+            "tar.gz"
+        };
+        for ( String extension : special ) 
+        {
+            if ( filename.endsWith( extension ) ) 
+            {
+                return extension;
+            }
+        }
+        return null;
+    }
     public Artifact build()
     {
         ArtifactReference ref = new ArtifactReference();
@@ -80,7 +99,12 @@ public class ArtifactBuilder
         File file = managedRepositoryContent.toFile( ref );
 
         String extension = FilenameUtils.getExtension( file.getName() );
-
+        // handle more than one point extension we know.
+        if ( specialExtensions( file.getName() ) != null ) 
+        {
+            extension = specialExtensions( file.getName() );
+        }
+        
         Artifact artifact = new Artifact( ref.getGroupId(), ref.getArtifactId(), ref.getVersion()
);
         artifact.setRepositoryId( artifactMetadata.getRepositoryId() );
         artifact.setClassifier( classifier );


Mime
View raw message