]> source.dussan.org Git - archiva.git/commitdiff
MRM-856 - Artifact Upload replaces all instances of the name "jar" with "pom" when...
authorJames William Dumay <jdumay@apache.org>
Wed, 2 Jul 2008 05:18:25 +0000 (05:18 +0000)
committerJames William Dumay <jdumay@apache.org>
Wed, 2 Jul 2008 05:18:25 +0000 (05:18 +0000)
* Use FilenameUtils from commons-io to properly strip the extension

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

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java

index eabcc1518575e03460a13f6338e5ca15c21370ff..d1a597f44b9fcb5a9a52079702cda9462221f600 100644 (file)
@@ -62,6 +62,7 @@ import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.Preparable;
 import com.opensymphony.xwork.Validateable;
+import org.apache.commons.io.FilenameUtils;
 
 /**
  * Upload an artifact using Jakarta file upload in webwork. If set by the user a pom will also be generated. Metadata
@@ -446,9 +447,10 @@ public class UploadAction
         projectModel.setArtifactId( artifactId );
         projectModel.setVersion( version );
         projectModel.setPackaging( packaging );
-
-        File pomFile = new File( targetPath, filename.replaceAll( packaging, "pom" ) );
-
+        
+        filename = FilenameUtils.removeExtension(filename) + ".pom";
+        File pomFile = new File( targetPath, filename);
+        
         pomWriter.write( projectModel, pomFile );
 
         return pomFile;