]> source.dussan.org Git - archiva.git/commitdiff
[MRM-664] Cannot download a strut-module artifact in a Legacy repository
authorBrett Porter <brett@apache.org>
Tue, 25 Mar 2008 14:08:17 +0000 (14:08 +0000)
committerBrett Porter <brett@apache.org>
Tue, 25 Mar 2008 14:08:17 +0000 (14:08 +0000)
- there seemed to be no reason to rename type from . to - apart from cosmetics so this was changed to allow - in extensions
Merged from: r640811

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@640823 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java
archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java
archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java

index 17702a192d5e297bee4ffdb67f553ea6fba048dd..5c9300b7095ac6aabf6d1ad81ead043e84574c4e 100644 (file)
@@ -64,7 +64,7 @@ public class ArtifactExtensionMapping
         }
 
         // Return type
-        return type.replace( '-', '.' );
+        return type;
     }
 
     /**
index e43bf073f1550cf5aeac16064c90785e9d5a2bc5..7c14233ba5f029a72c3e57757ea06826d0d9b517 100644 (file)
@@ -152,7 +152,7 @@ public class DefaultPathParser implements PathParser
                 case '.':
                     // We have an dual extension possibility.
                     String extension = parser.remaining() + '.' + parser.getExtension();
-                    artifact.setType( extension.replace( '.', '-' ) );
+                    artifact.setType( extension );
                     break;
                 case 0:
                     // End of the filename, only a simple extension left. - Set the type.
index 0acea93afc937d3641f4e1d1b7911458a169be27..fa49e5d1403acac0f1102263a44be192c5883f72 100644 (file)
@@ -41,7 +41,7 @@ public class FilenameParser
     private static final Pattern mavenPluginPattern = Pattern.compile( "(maven-.*-plugin)|(.*-maven-plugin)" );
 
     private static final Pattern extensionPattern =
-        Pattern.compile( "(\\.tar\\.gz$)|(\\.tar\\.bz2$)|(\\.[a-z0-9]*$)", Pattern.CASE_INSENSITIVE );
+        Pattern.compile( "(\\.tar\\.gz$)|(\\.tar\\.bz2$)|(\\.[\\-a-z0-9]*$)", Pattern.CASE_INSENSITIVE );
 
     private static final Pattern SNAPSHOT_PATTERN = Pattern.compile( "^([0-9]{8}\\.[0-9]{6}-[0-9]+)(.*)$" );
 
index 405218e23d3383a776d6f20ebaeef60313db9909..6da1ce21e05be07eefb4f4da39d356344ca725c5 100644 (file)
@@ -82,7 +82,7 @@ public class DefaultPathParserTest
         String artifactId = "example-presentation";
         String version = "3.2";
         String classifier = null;
-        String type = "xml-zip";
+        String type = "xml.zip";
         String path = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip";
 
         assertLayout( path, groupId, artifactId, version, classifier, type );
index 1ab8c807a976e9a22fc011d22baa986c7d295840..f911f4e8c51d530584d3069db1ead744eeb8cf03 100644 (file)
@@ -358,6 +358,16 @@ public class RepositoryRequestTest
                       repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository ) );
     }
 
+    public void testNativePathPomLegacyToLegacyStrutsModule()
+        throws Exception
+    {
+        ManagedRepositoryContent repository = createManagedRepo( "legacy" );
+
+        // Test (pom) legacy to default
+        assertEquals( "WebPortal/struts-modules/eventsDB-1.2.3.struts-module",
+                      repoRequest.toNativePath( "WebPortal/struts-modules/eventsDB-1.2.3.struts-module", repository ) );
+    }
+
     public void testNativePathSupportFileLegacyToDefault()
         throws Exception
     {