From e64880ef0767a6921498401e041bf9ad8dfa9a6f Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 27 Dec 2019 22:57:38 +0000 Subject: [PATCH] Ignore empty avatars in v115.go (#9520) * Ignore empty avatars * fixup! Ignore empty avatars --- models/migrations/v115.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.39.5