feat: rename file only when storagePath exists

This commit is contained in:
krau
2025-06-11 09:54:08 +08:00
parent 9d3a3a8dcd
commit e85d3c9441
8 changed files with 59 additions and 19 deletions

View File

@@ -63,3 +63,11 @@ func (l *Local) Save(ctx context.Context, r io.Reader, storagePath string) error
_, err = io.Copy(file, r)
return err
}
func (l *Local) Exists(ctx context.Context, storagePath string) bool {
absPath, err := filepath.Abs(storagePath)
if err != nil {
return false
}
return fileutil.IsExist(absPath)
}