XL/Multipart: Cleanup uploads.json after abort-multipart-upload. (#1678)

Fixes #1663
master
Krishna Srinivas 9 years ago committed by Harshavardhana
parent b69a97aed4
commit 71b9341fc7
  1. 20
      object-common-multipart.go

@ -237,7 +237,25 @@ func abortMultipartUploadCommon(storage StorageAPI, bucket, object, uploadID str
if !isUploadIDExists(storage, bucket, object, uploadID) {
return InvalidUploadID{UploadID: uploadID}
}
return cleanupUploadedParts(storage, bucket, object, uploadID)
if err := cleanupUploadedParts(storage, bucket, object, uploadID); err != nil {
return err
}
// Validate if there are other incomplete upload-id's present for
// the object, if yes do not attempt to delete 'uploads.json'.
if entries, err := storage.ListDir(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err == nil {
if len(entries) > 1 {
return nil
}
}
uploadsJSONPath := path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)
if err := storage.DeleteFile(minioMetaBucket, uploadsJSONPath); err != nil {
return err
}
return nil
}
// isIncompleteMultipart - is object incomplete multipart.

Loading…
Cancel
Save