diff --git a/models/migration.go b/models/migration.go index a2ce8b4..6a0eae1 100644 --- a/models/migration.go +++ b/models/migration.go @@ -66,9 +66,6 @@ func addDefaultPolicy() { DirNameRule: "uploads/{uid}/{path}", FileNameRule: "{uid}_{randomkey8}_{originname}", IsOriginLinkEnable: false, - OptionsSerialized: PolicyOption{ - FileType: []string{}, - }, } if err := DB.Create(&defaultPolicy).Error; err != nil { util.Log().Panic("无法创建初始存储策略, %s", err) diff --git a/pkg/crontab/collect.go b/pkg/crontab/collect.go index 6d504bc..16fb01d 100644 --- a/pkg/crontab/collect.go +++ b/pkg/crontab/collect.go @@ -30,7 +30,7 @@ func collectArchiveFile() { // 列出文件 root := filepath.Join(tempPath, "archive") err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - if err != nil && !info.IsDir() && + if err == nil && !info.IsDir() && strings.HasPrefix(filepath.Base(path), "archive_") && time.Now().Sub(info.ModTime()).Seconds() > float64(expires) { util.Log().Debug("删除过期打包下载临时文件 [%s]", path)