0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-11-10 13:31:01 -05:00

Refactor legacy code (#35708) (#35713)

Backport #35708
This commit is contained in:
wxiaoguang
2025-10-21 09:10:10 +08:00
committed by GitHub
parent 0a87bf9016
commit e818de179e
15 changed files with 407 additions and 236 deletions

View File

@@ -137,16 +137,9 @@ func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error) {
for _, upload := range uploads {
localPath := upload.LocalPath()
isFile, err := util.IsFile(localPath)
if err != nil {
log.Error("Unable to check if %s is a file. Error: %v", localPath, err)
}
if !isFile {
continue
}
if err := util.Remove(localPath); err != nil {
return fmt.Errorf("remove upload: %w", err)
// just continue, don't fail the whole operation if a file is missing (removed by others)
log.Error("unable to remove upload file %s: %v", localPath, err)
}
}