Skip to content

Commit

Permalink
Merge pull request #1208 from wal-g/fix-azure-list-folder-erroring
Browse files Browse the repository at this point in the history
Azure: fix ListFolder never returning error
  • Loading branch information
serprex committed Feb 3, 2022
2 parents ba6f4a2 + b92eb22 commit a9d0c1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/storages/azure/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ func (folder *Folder) ListFolder() (objects []storage.Object, subFolders []stora
blobPager := folder.containerClient.ListBlobsHierarchy("/", &azblob.ContainerListBlobHierarchySegmentOptions{Prefix: &folder.path})
for blobPager.NextPage(context.Background()) {
blobs := blobPager.PageResponse()
if err != nil {
return nil, nil, NewFolderError(err, "Unable to iterate %v", folder.path)
}
//add blobs to the list of storage objects
for _, blob := range blobs.Segment.BlobItems {
objName := strings.TrimPrefix(*blob.Name, folder.path)
Expand All @@ -201,6 +198,10 @@ func (folder *Folder) ListFolder() (objects []storage.Object, subFolders []stora
}

}
err = blobPager.Err()
if err != nil {
return nil, nil, NewFolderError(err, "Unable to iterate %v", folder.path)
}
return
}

Expand Down

0 comments on commit a9d0c1b

Please sign in to comment.