]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1769]Can't uploads multiple artifacts of different types send packaging attribute
authorOlivier Lamy <olamy@apache.org>
Thu, 28 Nov 2013 23:13:50 +0000 (23:13 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 28 Nov 2013 23:13:50 +0000 (23:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1546472 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js

index 308476686165fcbab58fb031320f87943b116507..eefe81a7bad0b61565a63d7b34ac23ac813028d7 100644 (file)
@@ -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();
index 1cce08331b95f58e5a539b531045a16b6136c151..acd86dbc705c759727237e8034a0d20555ce51ea 100644 (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"]
     , 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;
                 });
               }
           });