diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go index 803cb3b03e..d48397ef7e 100644 --- a/models/user.go +++ b/models/user.go @@ -891,8 +891,10 @@ func deleteUser(e *xorm.Session, u *User) error { } avatarPath := u.CustomAvatarPath() - if err := os.Remove(avatarPath); err != nil { - return fmt.Errorf("Fail to remove %s: %v", avatarPath, err) + if com.IsExist(avatarPath) { + if err := os.Remove(avatarPath); err != nil { + return fmt.Errorf("Fail to remove %s: %v", avatarPath, err) + } } return nil |