From 5a27aea8e05fcef3358f12e4e4bc75eb626b9a71 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 2 Feb 2016 10:22:27 -0500 Subject: [PATCH] Fix random avatar does not work on Windows path.Dir can't handle Windows case, must use filepath.Dir --- gogs.go | 2 +- models/user.go | 3 +-- templates/.VERSION | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gogs.go b/gogs.go index 1b804168fc..6659e909eb 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.8.27.0201" +const APP_VER = "0.8.27.0202" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) 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()) diff --git a/templates/.VERSION b/templates/.VERSION index f0ec56d666..859d0a2555 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.8.27.0201 \ No newline at end of file +0.8.27.0202 \ No newline at end of file