[MRM-1769]Can't uploads multiple artifacts of different types send packaging attribute

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1546472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-11-28 23:13:50 +00:00
parent 4f7f1d74f9
commit 6a75009b5c
2 changed files with 12 additions and 3 deletions

View File

@ -184,6 +184,11 @@ public class DefaultFileUploadService
File file = new File( SystemUtils.getJavaIoTmpDir(), fileName ); File file = new File( SystemUtils.getJavaIoTmpDir(), fileName );
log.debug( "delete file:{},exists:{}", file.getPath(), file.exists() ); log.debug( "delete file:{},exists:{}", file.getPath(), file.exists() );
boolean removed = getSessionFileMetadatas().remove( new FileMetadata( fileName ) ); boolean removed = getSessionFileMetadatas().remove( new FileMetadata( fileName ) );
// try with full name as ui only know the file name
if ( !removed )
{
removed = getSessionFileMetadatas().remove( new FileMetadata( file.getPath() ) );
}
if ( file.exists() ) if ( file.exists() )
{ {
return file.delete(); return file.delete();

View File

@ -20,9 +20,10 @@ define("archiva.artifacts-management",["jquery","i18n","utils","jquery.tmpl","kn
"knockout.simpleGrid","jquery.validate","bootstrap","jquery.fileupload","jquery.fileupload.ui"] "knockout.simpleGrid","jquery.validate","bootstrap","jquery.fileupload","jquery.fileupload.ui"]
, function(jquery,i18n,utils,jqueryTmpl,ko) { , function(jquery,i18n,utils,jqueryTmpl,ko) {
ArtifactUpload=function(classifier,pomFile){ ArtifactUpload=function(classifier,pomFile,packaging){
this.classifier=classifier; this.classifier=classifier;
this.pomFile=pomFile; this.pomFile=pomFile;
this.packaging=packaging;
} }
ArtifactUploadViewModel=function(managedRepositories){ ArtifactUploadViewModel=function(managedRepositories){
@ -102,19 +103,22 @@ define("archiva.artifacts-management",["jquery","i18n","utils","jquery.tmpl","kn
submit: function (e, data) { submit: function (e, data) {
var $this = $(this); var $this = $(this);
$this.fileupload('send', data); $this.fileupload('send', data);
artifactUploadViewModel.artifactUploads.push(new ArtifactUpload(data.formData.classifier,data.formData.pomFile)); artifactUploadViewModel.artifactUploads.push(new ArtifactUpload(data.formData.classifier,data.formData.pomFile,data.formData.packaging));
return false; return false;
} }
} }
); );
fileUpload.bind('fileuploadsubmit', function (e, data) { fileUpload.bind('fileuploadsubmit', function (e, data) {
var pomFile = data.context.find('#pomFile' ).is(":checked"); var pomFile = data.context.find('#pomFile' ).is(":checked");
var classifier = data.context.find('#classifier' ).val(); var classifier = data.context.find('#classifier').val();
var packaging = data.context.find('#packaging' ).val();
$.log("packaging:"+packaging);
if (!data.formData){ if (!data.formData){
data.formData={}; data.formData={};
} }
data.formData.pomFile = pomFile; data.formData.pomFile = pomFile;
data.formData.classifier = classifier; data.formData.classifier = classifier;
data.formData.packaging = packaging;
}); });
} }
}); });