diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-06 16:07:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-06 16:07:18 +0800 |
commit | 03760292412ffb3f65f2bfc359cb3bda100c5c98 (patch) | |
tree | 47f062b6bfe36ab4d428700c6482d765196486bf /models/org.go | |
parent | 7b64b2ddab4344214e9173943df7771dc0f9aa99 (diff) | |
download | gitea-03760292412ffb3f65f2bfc359cb3bda100c5c98.tar.gz gitea-03760292412ffb3f65f2bfc359cb3bda100c5c98.zip |
fix del org avatar potential delete all avtars (#1120)
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/models/org.go b/models/org.go index 49dcfcaa62..d6cbcc9658 100644 --- a/models/org.go +++ b/models/org.go @@ -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) + } } } |