diff options
author | Unknwon <u@gogs.io> | 2016-02-02 10:22:27 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-02 10:22:27 -0500 |
commit | 5a27aea8e05fcef3358f12e4e4bc75eb626b9a71 (patch) | |
tree | dda90ec097f93cb9db54e82c7100bd6852735744 /models/user.go | |
parent | 1c74612b3c025282d4731880575922c797813ca7 (diff) | |
download | gitea-5a27aea8e05fcef3358f12e4e4bc75eb626b9a71.tar.gz gitea-5a27aea8e05fcef3358f12e4e4bc75eb626b9a71.zip |
Fix random avatar does not work on Windows
path.Dir can't handle Windows case, must use filepath.Dir
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go index 31ac1e22dc..23ed5ae8d2 100644 --- a/models/user.go +++ b/models/user.go @@ -16,7 +16,6 @@ import ( _ "image/jpeg" "image/png" "os" - "path" "path/filepath" "strings" "time" @@ -211,7 +210,7 @@ func (u *User) GenerateRandomAvatar() error { if err != nil { return fmt.Errorf("RandomImage: %v", err) } - if err = os.MkdirAll(path.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { + if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { return fmt.Errorf("MkdirAll: %v", err) } fw, err := os.Create(u.CustomAvatarPath()) |