Don't fail if the last avatar file does not exist when deleting it
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
kolaente 2020-08-02 16:02:10 +02:00
parent 5f98defca1
commit e10494f34e
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 1 deletions

View File

@ -146,7 +146,9 @@ func UploadAvatar(c echo.Context) (err error) {
if u.AvatarFileID != 0 {
f := &files.File{ID: u.AvatarFileID}
if err := f.Delete(); err != nil {
return handler.HandleHTTPError(err, c)
if !files.IsErrFileDoesNotExist(err) {
return handler.HandleHTTPError(err, c)
}
}
u.AvatarFileID = 0
}