We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4acca9d commit 20d6575Copy full SHA for 20d6575
models/migrations/v115.go
@@ -47,7 +47,10 @@ func renameExistingUserAvatarName(x *xorm.Engine) error {
47
for _, user := range users {
48
oldAvatar := user.Avatar
49
50
- 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() {
51
+ if stat != nil && stat.IsDir() {
52
+ err = fmt.Errorf("Error: \"%s\" is not a regular file", oldAvatar)
53
+ }
54
log.Warn("[user: %s] os.Stat: %v", user.LowerName, err)
55
// avatar doesn't exist in the storage
56
// no need to move avatar and update database
0 commit comments