azureblob: fix NewObject on a directory returning "is not a regular file"

On storage accounts with a hierarchical namespace, directories can be
read as blobs so NewObject on a directory returned fs.ErrorNotAFile
rather than fs.ErrorObjectNotFound.
This commit is contained in:
Nick Craig-Wood committed 2026-10-08 10:53:05 +01:00
1 parent 93c2787dc8
commit 90f3e8e5c0
1 file changed
+6 -1
+6 -1
View File
@@ -850,7 +850,12 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *contain
// NewObject finds the Object at remote. If it can't be found
// it returns the error fs.ErrorObjectNotFound.
func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
return f.newObjectWithInfo(ctx, remote, nil)
o, err := f.newObjectWithInfo(ctx, remote, nil)
if err == fs.ErrorNotAFile {
// The blob is a directory
return nil, fs.ErrorObjectNotFound
}
return o, err
}
// getBlobSVC creates a blob client