mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-09-05 15:46:37 +08:00
Update storage/alist/alist.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+13
-2
@@ -267,8 +267,19 @@ func (a *Alist) ListFiles(ctx context.Context, dirPath string) ([]storagetypes.F
|
|||||||
|
|
||||||
files := make([]storagetypes.FileInfo, 0, len(listResp.Data.Content))
|
files := make([]storagetypes.FileInfo, 0, len(listResp.Data.Content))
|
||||||
for _, item := range listResp.Data.Content {
|
for _, item := range listResp.Data.Content {
|
||||||
// Parse modified time
|
// Parse modified time; log failures but keep zero value on error.
|
||||||
modTime, _ := time.Parse(time.RFC3339, item.Modified)
|
var modTime time.Time
|
||||||
|
if item.Modified != "" {
|
||||||
|
parsedTime, err := time.Parse(time.RFC3339, item.Modified)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.With(
|
||||||
|
"path", path.Join(dirPath, item.Name),
|
||||||
|
"modified_raw", item.Modified,
|
||||||
|
).Warnf("failed to parse modified time for file")
|
||||||
|
} else {
|
||||||
|
modTime = parsedTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
files = append(files, storagetypes.FileInfo{
|
files = append(files, storagetypes.FileInfo{
|
||||||
Name: item.Name,
|
Name: item.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user