From 6a2d7ae8081ce52605444d917c5cf00eb8f3d4fc Mon Sep 17 00:00:00 2001 From: Paul Nicholls Date: Tue, 28 Nov 2017 14:42:27 +1300 Subject: [PATCH] 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. --- cmd/gateway-azure.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/gateway-azure.go b/cmd/gateway-azure.go index 5295a8d7d..5db25048f 100644 --- a/cmd/gateway-azure.go +++ b/cmd/gateway-azure.go @@ -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) }