Skip to content

fix(azure_blob): handle root path listing - #9629

Open
Kukmoon wants to merge 1 commit into
AlistGo:mainfrom
Kukmoon:fix/azure-blob-list
Open

fix(azure_blob): handle root path listing#9629
Kukmoon wants to merge 1 commit into
AlistGo:mainfrom
Kukmoon:fix/azure-blob-list

Conversation

@Kukmoon

@Kukmoon Kukmoon commented Aug 23, 2026

Copy link
Copy Markdown

Description

Fix Azure Blob Storage root directory listing.

Problem

When the Azure Blob Storage driver receives the root path, dir.GetPath() can be an empty string. The Azure Blob Storage container contained blobs, including a previously uploaded file, but the root directory was displayed as empty in Alist.

The previous implementation always called ensureTrailingSlash():

prefix := ensureTrailingSlash(dir.GetPath())

This converted the root path from "" to "/".

For Azure Blob Storage listing, using "/" as the root prefix does not match blob names that do not begin with /, resulting in an empty root directory listing.

Image

The Azure Blob Storage container did contain files:

Image

Fix

Handle the root path explicitly:

prefix := dir.GetPath()
if prefix == "" || prefix == "/" {
    prefix = ""
} else {
    prefix = ensureTrailingSlash(prefix)
}

This preserves an empty prefix for the root directory while continuing to append / for non-root directories.

Testing

  • gofmt passed
  • git diff --check passed
  • Project compiled successfully
  • Verified Azure Blob Storage root listing
  • Verified entering subdirectories
  • Verified uploading files into a subdirectory
  • Verified uploaded files can be listed normally

The final result:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants