From 90f3e8e5c09356912eb08aa22e90cf98d2cd523a Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 6 Oct 2026 15:58:16 +0100 Subject: [PATCH] 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. --- backend/azureblob/azureblob.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 03894e0f5..09b8c2aa5 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -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