Skip to content

Commit

Permalink
Ignore empty avatars in v115.go (#9520)
Browse files Browse the repository at this point in the history
* Ignore empty avatars

* fixup! Ignore empty avatars
  • Loading branch information
zeripath authored and lafriks committed Dec 27, 2019
1 parent 4acca9d commit e64880e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion models/migrations/v115.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func renameExistingUserAvatarName(x *xorm.Engine) error {
for _, user := range users {
oldAvatar := user.Avatar

if _, err := os.Stat(filepath.Join(setting.AvatarUploadPath, oldAvatar)); err != nil {
if stat, err := os.Stat(filepath.Join(setting.AvatarUploadPath, oldAvatar)); err != nil || !stat.Mode().IsRegular() {
if err == nil {
err = fmt.Errorf("Error: \"%s\" is not a regular file", oldAvatar)
}
log.Warn("[user: %s] os.Stat: %v", user.LowerName, err)
// avatar doesn't exist in the storage
// no need to move avatar and update database
Expand Down

0 comments on commit e64880e

Please sign in to comment.