diff --git a/pkg/filesystem/driver/s3/handler.go b/pkg/filesystem/driver/s3/handler.go index 56a7aaaedf..8f37bab14d 100644 --- a/pkg/filesystem/driver/s3/handler.go +++ b/pkg/filesystem/driver/s3/handler.go @@ -147,14 +147,25 @@ 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: time.Now(), - }) + + 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