Skip to content

Commit

Permalink
fix del org avatar potential delete all avtars (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Mar 6, 2017
1 parent 7b64b2d commit 0376029
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions models/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ func deleteOrg(e *xorm.Session, u *User) error {
return fmt.Errorf("Failed to RemoveAll %s: %v", path, err)
}

avatarPath := u.CustomAvatarPath()
if com.IsExist(avatarPath) {
if err := os.Remove(avatarPath); err != nil {
return fmt.Errorf("Failed to remove %s: %v", avatarPath, err)
if len(u.Avatar) > 0 {
avatarPath := u.CustomAvatarPath()
if com.IsExist(avatarPath) {
if err := os.Remove(avatarPath); err != nil {
return fmt.Errorf("Failed to remove %s: %v", avatarPath, err)
}
}
}

Expand Down

0 comments on commit 0376029

Please sign in to comment.