summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-02-02 10:22:27 -0500
committerUnknwon <u@gogs.io>2016-02-02 10:22:27 -0500
commit5a27aea8e05fcef3358f12e4e4bc75eb626b9a71 (patch)
treedda90ec097f93cb9db54e82c7100bd6852735744 /models/user.go
parent1c74612b3c025282d4731880575922c797813ca7 (diff)
downloadgitea-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.go3
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())