Modify: mark as success when deleting a file that does not exist;

Fix: minio is not usable in S3 policy
Modify: use batch request to delete S3 files
This commit is contained in:
HFO4
2021-02-28 16:48:51 +08:00
parent 9c78515c72
commit e699287ffd
5 changed files with 39 additions and 54 deletions

View File

@ -130,11 +130,14 @@ func (handler Driver) Delete(ctx context.Context, files []string) ([]string, err
var retErr error
for _, value := range files {
err := os.Remove(util.RelativePath(filepath.FromSlash(value)))
if err != nil {
util.Log().Warning("无法删除文件,%s", err)
retErr = err
deleteFailed = append(deleteFailed, value)
filePath := util.RelativePath(filepath.FromSlash(value))
if util.Exists(filePath) {
err := os.Remove(filePath)
if err != nil {
util.Log().Warning("无法删除文件,%s", err)
retErr = err
deleteFailed = append(deleteFailed, value)
}
}
// 尝试删除文件的缩略图(如果有)