From 8587d18868766ac1c656071e806de07920caced7 Mon Sep 17 00:00:00 2001 From: haibingtown Date: Thu, 21 Dec 2023 01:19:25 +0800 Subject: [PATCH 1/2] fix oss import bug --- pkg/filesystem/driver/oss/handler.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pkg/filesystem/driver/oss/handler.go b/pkg/filesystem/driver/oss/handler.go index 2ae50a375e..ccccbd2c5f 100644 --- a/pkg/filesystem/driver/oss/handler.go +++ b/pkg/filesystem/driver/oss/handler.go @@ -172,14 +172,24 @@ func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([ if err != nil { continue } - res = append(res, response.Object{ - Name: path.Base(object.Key), - Source: object.Key, - RelativePath: filepath.ToSlash(rel), - Size: uint64(object.Size), - IsDir: false, - LastModify: object.LastModified, - }) + if strings.HasSuffix(object.Key, "/") { + res = append(res, response.Object{ + Name: path.Base(object.Key), + RelativePath: filepath.ToSlash(rel), + Size: 0, + IsDir: true, + LastModify: time.Now(), + }) + } else { + res = append(res, response.Object{ + Name: path.Base(object.Key), + Source: object.Key, + RelativePath: filepath.ToSlash(rel), + Size: uint64(object.Size), + IsDir: false, + LastModify: object.LastModified, + }) + } } return res, nil From 44373e65a16adbf69f36d9f5ee7e412730b8dda0 Mon Sep 17 00:00:00 2001 From: haibingtown Date: Fri, 22 Dec 2023 21:52:59 +0800 Subject: [PATCH 2/2] fix oss import bug --- pkg/filesystem/driver/oss/handler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/filesystem/driver/oss/handler.go b/pkg/filesystem/driver/oss/handler.go index ccccbd2c5f..26e5bda3d1 100644 --- a/pkg/filesystem/driver/oss/handler.go +++ b/pkg/filesystem/driver/oss/handler.go @@ -172,6 +172,7 @@ func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([ if err != nil { continue } + if strings.HasSuffix(object.Key, "/") { res = append(res, response.Object{ Name: path.Base(object.Key),