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
This commit is contained in:
James William Dumay 2008-07-02 05:18:25 +00:00
parent b4e15d6eb1
commit 571c96c635
1 changed files with 5 additions and 3 deletions

View 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
@ -447,7 +448,8 @@ public class UploadAction
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 );