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.
This commit is contained in:
Paul Nicholls 2017-11-28 14:42:27 +13:00 committed by Harshavardhana
parent 685afb6749
commit 6a2d7ae808

View File

@ -746,6 +746,11 @@ func (a *azureObjects) ListObjectParts(bucket, object, uploadID string, partNumb
objBlob := a.client.GetContainerReference(bucket).GetBlobReference(object)
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 {
return result, azureToObjectError(errors.Trace(err), bucket, object)
}