From 6a75009b5c08b379f61e32fe941754f7771c7a71 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 28 Nov 2013 23:13:50 +0000 Subject: [PATCH] [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 --- .../archiva/web/api/DefaultFileUploadService.java | 5 +++++ .../src/main/webapp/js/archiva/artifacts-management.js | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java index 308476686..eefe81a7b 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java @@ -184,6 +184,11 @@ public class DefaultFileUploadService File file = new File( SystemUtils.getJavaIoTmpDir(), fileName ); log.debug( "delete file:{},exists:{}", file.getPath(), file.exists() ); 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() ) { return file.delete(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js index 1cce08331..acd86dbc7 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js @@ -20,9 +20,10 @@ define("archiva.artifacts-management",["jquery","i18n","utils","jquery.tmpl","kn "knockout.simpleGrid","jquery.validate","bootstrap","jquery.fileupload","jquery.fileupload.ui"] , function(jquery,i18n,utils,jqueryTmpl,ko) { - ArtifactUpload=function(classifier,pomFile){ + ArtifactUpload=function(classifier,pomFile,packaging){ this.classifier=classifier; this.pomFile=pomFile; + this.packaging=packaging; } ArtifactUploadViewModel=function(managedRepositories){ @@ -102,19 +103,22 @@ define("archiva.artifacts-management",["jquery","i18n","utils","jquery.tmpl","kn submit: function (e, data) { var $this = $(this); $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; } } ); fileUpload.bind('fileuploadsubmit', function (e, data) { 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){ data.formData={}; } data.formData.pomFile = pomFile; data.formData.classifier = classifier; + data.formData.packaging = packaging; }); } });