优化
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
cos "github.com/tencentyun/cos-go-sdk-v5"
|
||||
"kra/internal/biz"
|
||||
@@ -107,7 +108,14 @@ func (s *tencentStorage) List(ctx context.Context, prefix, cursor string, limit
|
||||
}
|
||||
items := make([]*biz.StoredFile, 0, len(result.Contents))
|
||||
for _, object := range result.Contents {
|
||||
items = append(items, s.file(object.Key, object.Size))
|
||||
item := s.file(object.Key, object.Size)
|
||||
for _, layout := range []string{time.RFC3339, "2006-01-02T15:04:05.000Z"} {
|
||||
if parsed, parseErr := time.Parse(layout, object.LastModified); parseErr == nil {
|
||||
item.LastModified = parsed
|
||||
break
|
||||
}
|
||||
}
|
||||
items = append(items, item)
|
||||
}
|
||||
next := result.NextMarker
|
||||
if result.IsTruncated && next == "" && len(result.Contents) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user