diff options
author | zeripath <art27@cantab.net> | 2019-12-27 22:57:38 +0000 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-12-28 00:57:37 +0200 |
commit | e64880ef0767a6921498401e041bf9ad8dfa9a6f (patch) | |
tree | 19e987dfb170b956d04bde4240ce232a4374acd6 /models/migrations | |
parent | 4acca9d2e8618a5283495fcd3b313fd53c953f18 (diff) | |
download | gitea-e64880ef0767a6921498401e041bf9ad8dfa9a6f.tar.gz gitea-e64880ef0767a6921498401e041bf9ad8dfa9a6f.zip |
Ignore empty avatars in v115.go (#9520)
* Ignore empty avatars
* fixup! Ignore empty avatars
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/v115.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/models/migrations/v115.go b/models/migrations/v115.go index f1603b7976..67d37536c0 100644 --- a/models/migrations/v115.go +++ b/models/migrations/v115.go @@ -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 |