mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-03-13 11:20:33 +00:00
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:
@@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user