Return if paths are empty in DeleteFileBulk (#8085)

This avoids a network call, also fixes an issue
when empty paths are passed the underlying call
fails with "405 Method Not Allowed".

This is reproducible when you are deleting a
non-existent object.

Fixes #8083
This commit is contained in:
Harshavardhana 2019-08-15 13:15:49 -07:00 committed by GitHub
parent 825e29f301
commit 6e7962bf35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,6 +374,9 @@ func (client *storageRESTClient) DeleteFile(volume, path string) error {
// DeleteFileBulk - deletes files in bulk.
func (client *storageRESTClient) DeleteFileBulk(volume string, paths []string) (errs []error, err error) {
if len(paths) == 0 {
return errs, err
}
errs = make([]error, len(paths))
values := make(url.Values)
values.Set(storageRESTVolume, volume)