gateway/azure: ListParts return an empty list if no parts uploaded yet (#5230)

This makes azure ListParts implementation behave more like S3 
by returning an empty list rather than an error when no parts have
been uploaded yet.
master
Paul Nicholls 7 years ago committed by Harshavardhana
parent 685afb6749
commit 6a2d7ae808
  1. 5
      cmd/gateway-azure.go

@ -746,6 +746,11 @@ func (a *azureObjects) ListObjectParts(bucket, object, uploadID string, partNumb
objBlob := a.client.GetContainerReference(bucket).GetBlobReference(object) objBlob := a.client.GetContainerReference(bucket).GetBlobReference(object)
resp, err := objBlob.GetBlockList(storage.BlockListTypeUncommitted, nil) resp, err := objBlob.GetBlockList(storage.BlockListTypeUncommitted, nil)
azureErr, ok := err.(storage.AzureStorageServiceError)
if ok && azureErr.StatusCode == http.StatusNotFound {
// If no parts are uploaded yet then we return empty list.
return result, nil
}
if err != nil { if err != nil {
return result, azureToObjectError(errors.Trace(err), bucket, object) return result, azureToObjectError(errors.Trace(err), bucket, object)
} }

Loading…
Cancel
Save