aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames William Dumay <jdumay@apache.org>2008-07-02 05:18:25 +0000
committerJames William Dumay <jdumay@apache.org>2008-07-02 05:18:25 +0000
commit571c96c635c71662b388404a07ea1a9b01e6de37 (patch)
tree88ffba9679ee13624c7ee1ad5b4616da9cf2b413
parentb4e15d6eb1bc4525e7232c4ccd10cc2d4359660f (diff)
downloadarchiva-571c96c635c71662b388404a07ea1a9b01e6de37.tar.gz
archiva-571c96c635c71662b388404a07ea1a9b01e6de37.zip
MRM-856 - Artifact Upload replaces all instances of the name "jar" with "pom" when trying to change the file extension
* 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
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
index eabcc1518..d1a597f44 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
@@ -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;