fix(azure): remove properties and fix prefix (#2209)

Remove properties from azure blob response

fix azure blob prefix filter: prefix should be empty if it is "/"
This commit is contained in:
Roy
2026-03-09 21:25:30 +08:00
committed by GitHub
parent b5626b275b
commit 5eaef96078

View File

@@ -85,6 +85,9 @@ func (d *AzureBlob) Drop(ctx context.Context) error {
// List retrieves blobs and directories under the specified path. // List retrieves blobs and directories under the specified path.
func (d *AzureBlob) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) { func (d *AzureBlob) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
prefix := ensureTrailingSlash(dir.GetPath()) prefix := ensureTrailingSlash(dir.GetPath())
if prefix == "/" {
prefix = ""
}
pager := d.containerClient.NewListBlobsHierarchyPager("/", &container.ListBlobsHierarchyOptions{ pager := d.containerClient.NewListBlobsHierarchyPager("/", &container.ListBlobsHierarchyOptions{
Prefix: &prefix, Prefix: &prefix,
@@ -100,10 +103,11 @@ func (d *AzureBlob) List(ctx context.Context, dir model.Obj, args model.ListArgs
// Process directories // Process directories
for _, blobPrefix := range page.Segment.BlobPrefixes { for _, blobPrefix := range page.Segment.BlobPrefixes {
objs = append(objs, &model.Object{ objs = append(objs, &model.Object{
Name: path.Base(strings.TrimSuffix(*blobPrefix.Name, "/")), Name: path.Base(strings.TrimSuffix(*blobPrefix.Name, "/")),
Path: *blobPrefix.Name, Path: *blobPrefix.Name,
Modified: *blobPrefix.Properties.LastModified, // Azure does not support properties now.
Ctime: *blobPrefix.Properties.CreationTime, //Modified: *blobPrefix.Properties.LastModified,
//Ctime: *blobPrefix.Properties.CreationTime,
IsFolder: true, IsFolder: true,
}) })
} }