Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

azureblob: fix listing a file as a directory on hierarchical namespace accounts

Nick Craig-Woodd59797229731
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 09b8c2aa5..18aba2b00 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1318,6 +1318,13 @@ func (f *Fs) listBlobsPager(ctx context.Context, containerName, directory, prefi
fs.Debugf(f, "Nil name received")
continue
}
+ // Storage accounts with a hierarchical namespace return
+ // the file "dir" when listing "dir/"
+ if !strings.HasPrefix(*file.Name, directory) {
+ fs.Debugf(f, "Ignoring %q not in directory %q", *file.Name, directory)
+ foundItems--
+ continue
+ }
remote := f.opt.Enc.ToStandardPath(*file.Name)
if !strings.HasPrefix(remote, prefix) {
fs.Debugf(f, "Odd name received %q", remote)