From 6e7962bf35a4daf43886cb54e14ab2d5f5b8dc14 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 15 Aug 2019 13:15:49 -0700 Subject: [PATCH] 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 --- cmd/storage-rest-client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/storage-rest-client.go b/cmd/storage-rest-client.go index f74a781d1..637074a7d 100644 --- a/cmd/storage-rest-client.go +++ b/cmd/storage-rest-client.go @@ -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)