mirror of https://github.com/apache/archiva.git
cleanup service to delete uploaded files, add form validation before starting upload
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1307831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62a08312f9
commit
49e0e7b486
|
@ -190,7 +190,7 @@ public class DefaultFileUploadService
|
||||||
public Boolean clearUploadedFiles()
|
public Boolean clearUploadedFiles()
|
||||||
throws ArchivaRestServiceException
|
throws ArchivaRestServiceException
|
||||||
{
|
{
|
||||||
List<FileMetadata> fileMetadatas = getSessionFileMetadatas();
|
List<FileMetadata> fileMetadatas = new ArrayList( getSessionFileMetadatas() );
|
||||||
for ( FileMetadata fileMetadata : fileMetadatas )
|
for ( FileMetadata fileMetadata : fileMetadatas )
|
||||||
{
|
{
|
||||||
deleteFile( fileMetadata.getServerFileName() );
|
deleteFile( fileMetadata.getServerFileName() );
|
||||||
|
@ -222,13 +222,7 @@ public class DefaultFileUploadService
|
||||||
{
|
{
|
||||||
public boolean apply( FileMetadata fileMetadata )
|
public boolean apply( FileMetadata fileMetadata )
|
||||||
{
|
{
|
||||||
if ( fileMetadata == null )
|
return fileMetadata != null && !fileMetadata.isPomFile();
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return StringUtils.equals( groupId, fileMetadata.getGroupId() ) && StringUtils.equals( artifactId,
|
|
||||||
fileMetadata.getArtifactId() )
|
|
||||||
&& !fileMetadata.isPomFile();
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
Iterator<FileMetadata> iterator = filesToAdd.iterator();
|
Iterator<FileMetadata> iterator = filesToAdd.iterator();
|
||||||
|
@ -245,7 +239,7 @@ public class DefaultFileUploadService
|
||||||
{
|
{
|
||||||
public boolean apply( @Nullable FileMetadata fileMetadata )
|
public boolean apply( @Nullable FileMetadata fileMetadata )
|
||||||
{
|
{
|
||||||
return fileMetadata.isPomFile();
|
return fileMetadata != null && fileMetadata.isPomFile();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,9 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
|
||||||
});
|
});
|
||||||
$('#fileupload').fileupload({
|
$('#fileupload').fileupload({
|
||||||
add: function (e, data) {
|
add: function (e, data) {
|
||||||
|
if(!mainContent.find("#fileupload" ).valid()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.formData = {
|
data.formData = {
|
||||||
groupId: artifactUploadViewModel.groupId(),
|
groupId: artifactUploadViewModel.groupId(),
|
||||||
artifactId: artifactUploadViewModel.artifactId(),
|
artifactId: artifactUploadViewModel.artifactId(),
|
||||||
|
|
Loading…
Reference in New Issue