mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-18 11:46:23 -07:00
If deleting a post's file returns a not found error, log it but don't show the error
This commit is contained in:
parent
81da3cd433
commit
81270067d5
1 changed files with 13 additions and 3 deletions
|
@ -330,9 +330,19 @@ func deletePostFiles(posts []delPost, deleteIDs []any, permDelete bool, request
|
|||
var tmpErr error
|
||||
for _, post := range posts {
|
||||
if tmpErr = post.deleteFile(permDelete); tmpErr != nil {
|
||||
errArr.Int(post.postID).Err(err)
|
||||
if err == nil {
|
||||
err = tmpErr
|
||||
gcutil.LogWarning().Err(tmpErr).Caller().
|
||||
Int("postID", post.postID).
|
||||
Int("opID", post.opID).
|
||||
Str("filename", post.filename).
|
||||
Str("board", post.boardDir).
|
||||
Msg("Got error when trying to delete file")
|
||||
if os.IsNotExist(tmpErr) {
|
||||
tmpErr = nil
|
||||
} else {
|
||||
errArr.Int(post.postID).Err(err)
|
||||
if err == nil {
|
||||
err = tmpErr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue