Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite81cfbc

Browse files
authored
fix: remove file entry when trying to delete a non-existant file (#1765)
Co-authored-by: crwxaj <crwxaj>
1 parent9264132 commite81cfbc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎pkg/api/files.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package api
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
7+
"io/fs"
68
"net/http"
79
"os"
810
"path/filepath"
@@ -347,7 +349,7 @@ func removeFileByFileId(fileId uint) models.Scene {
347349
switchfile.Volume.Type {
348350
case"local":
349351
err:=os.Remove(filepath.Join(file.Path,file.Filename))
350-
iferr==nil {
352+
iferr==nil||errors.Is(err,fs.ErrNotExist){
351353
deleted=true
352354
}else {
353355
log.Errorf("error deleting file: %v",err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp