1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

fix del org avatar potential delete all avtars (#1120)

This commit is contained in:
Lunny Xiao 2017-03-06 16:07:18 +08:00 committed by GitHub
parent 7b64b2ddab
commit 0376029241

View file

@ -275,12 +275,14 @@ func deleteOrg(e *xorm.Session, u *User) error {
return fmt.Errorf("Failed to RemoveAll %s: %v", path, err) return fmt.Errorf("Failed to RemoveAll %s: %v", path, err)
} }
if len(u.Avatar) > 0 {
avatarPath := u.CustomAvatarPath() avatarPath := u.CustomAvatarPath()
if com.IsExist(avatarPath) { if com.IsExist(avatarPath) {
if err := os.Remove(avatarPath); err != nil { if err := os.Remove(avatarPath); err != nil {
return fmt.Errorf("Failed to remove %s: %v", avatarPath, err) return fmt.Errorf("Failed to remove %s: %v", avatarPath, err)
} }
} }
}
return nil return nil
} }