archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1542152 - in /archiva/trunk/archiva-modules/archiva-web: archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ archiva-web-common/src/main/java/org/apache/archiva/web/api/ archiva-webapp/src/main/webapp/js/archiva/
Date Fri, 15 Nov 2013 01:38:19 GMT
Author: olamy
Date: Fri Nov 15 01:38:18 2013
New Revision: 1542152

URL: http://svn.apache.org/r1542152
Log:
[MRM-1762] Upload Artifact page allows to uploading SNAPSHOT versions to non snapshot repositories

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java
    archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java?rev=1542152&r1=1542151&r2=1542152&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java
Fri Nov 15 01:38:18 2013
@@ -91,4 +91,5 @@ public class ArchivaRestServiceException
     {
         this.fieldName = fieldName;
     }
+
 }

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java?rev=1542152&r1=1542151&r2=1542152&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
Fri Nov 15 01:38:18 2013
@@ -128,7 +128,7 @@ public class DefaultFileUploadService
             // skygo: http header form pomFile was once sending 1 for true and void for false
             // leading to permanent false value for pomFile if using toBoolean(); use , "1",
""
             boolean pomFile = BooleanUtils.toBoolean( getStringValue( multipartBody, "pomFile"
) );
-            
+
             Attachment file = multipartBody.getAttachment( "files[]" );
 
             //Content-Disposition: form-data; name="files[]"; filename="org.apache.karaf.features.command-2.2.2.jar"
@@ -219,6 +219,32 @@ public class DefaultFileUploadService
         {
             return Boolean.FALSE;
         }
+
+        try
+        {
+            ManagedRepository managedRepository = managedRepositoryAdmin.getManagedRepository(
repositoryId );
+
+            if ( managedRepository == null )
+            {
+                // TODO i18n ?
+                throw new ArchivaRestServiceException( "Cannot find managed repository with
id " + repositoryId,
+                                                       Response.Status.BAD_REQUEST.getStatusCode(),
null );
+            }
+
+            if ( VersionUtil.isSnapshot( version ) && !managedRepository.isSnapshots()
)
+            {
+                // TODO i18n ?
+                throw new ArchivaRestServiceException(
+                    "Managed repository with id " + repositoryId + " do not accept snapshots",
+                    Response.Status.BAD_REQUEST.getStatusCode(), null );
+            }
+        }
+        catch ( RepositoryAdminException e )
+        {
+            throw new ArchivaRestServiceException( e.getMessage(),
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
e );
+        }
+
         // get from the session file with groupId/artifactId
 
         Iterable<FileMetadata> filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>()

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js?rev=1542152&r1=1542151&r2=1542152&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/artifacts-management.js
Fri Nov 15 01:38:18 2013
@@ -82,7 +82,7 @@ define("archiva.artifacts-management",["
         type: "GET",
         dataType: 'json',
         success: function(data) {
-          mainContent.html($("#file-upload-screen" ).html());
+          mainContent.html($("#file-upload-screen").html());
           $.ajax("restServices/archivaServices/browseService/userRepositories", {
               type: "GET",
               dataType: 'json',



Mime
View raw message