mirror of
https://github.com/minio/minio.git
synced 2025-11-21 10:16:03 -05:00
Fix error handling in DeleteFileBulk storage handler (#8327)
errors.errorString() cannot be marshalled by gob encoder, so using a slice of []error would fail to be encoded. This leads to no errors being generated instead gob.Decoder on the storage-client would see an io.EOF To avoid such bugs introduce a typed error for handling such translations and register this type for gob encoding support.
This commit is contained in:
@@ -375,7 +375,6 @@ func (client *storageRESTClient) DeleteFileBulk(volume string, paths []string) (
|
||||
if len(paths) == 0 {
|
||||
return errs, err
|
||||
}
|
||||
errs = make([]error, len(paths))
|
||||
values := make(url.Values)
|
||||
values.Set(storageRESTVolume, volume)
|
||||
for _, path := range paths {
|
||||
@@ -388,14 +387,13 @@ func (client *storageRESTClient) DeleteFileBulk(volume string, paths []string) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bulkErrs := bulkErrorsResponse{}
|
||||
gob.NewDecoder(respBody).Decode(&bulkErrs)
|
||||
if err != nil {
|
||||
dErrResp := &DeleteFileBulkErrsResp{}
|
||||
if err = gob.NewDecoder(respBody).Decode(dErrResp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i, dErr := range bulkErrs.Errs {
|
||||
errs[i] = toStorageErr(dErr)
|
||||
for _, dErr := range dErrResp.Errs {
|
||||
errs = append(errs, toStorageErr(dErr))
|
||||
}
|
||||
|
||||
return errs, nil
|
||||
|
||||
Reference in New Issue
Block a user