mirror of https://github.com/apache/archiva.git
[MRM-1762] Upload Artifact page allows to uploading SNAPSHOT versions to non snapshot repositories
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1542152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
76b43a9254
commit
86c913a95e
|
@ -91,4 +91,5 @@ public class ArchivaRestServiceException
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,32 @@ public class DefaultFileUploadService
|
||||||
{
|
{
|
||||||
return Boolean.FALSE;
|
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
|
// get from the session file with groupId/artifactId
|
||||||
|
|
||||||
Iterable<FileMetadata> filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>()
|
Iterable<FileMetadata> filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>()
|
||||||
|
|
|
@ -82,7 +82,7 @@ define("archiva.artifacts-management",["jquery","i18n","utils","jquery.tmpl","kn
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
mainContent.html($("#file-upload-screen" ).html());
|
mainContent.html($("#file-upload-screen").html());
|
||||||
$.ajax("restServices/archivaServices/browseService/userRepositories", {
|
$.ajax("restServices/archivaServices/browseService/userRepositories", {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
Loading…
Reference in New Issue