From 376a629c9f99893f341e76163e9b61273dd32c28 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 17 Jun 2018 22:18:41 +0800 Subject: repo: add changes to repository avatar feature (#5221) --- cmd/backup.go | 2 +- cmd/restore.go | 2 +- cmd/web.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/backup.go b/cmd/backup.go index ad635a4d..0adde979 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -100,7 +100,7 @@ func runBackup(c *cli.Context) error { // Data files if !c.Bool("database-only") { - for _, dir := range []string{"attachments", "avatars"} { + for _, dir := range []string{"attachments", "avatars", "repo-avatars"} { dirPath := path.Join(setting.AppDataPath, dir) if !com.IsDir(dirPath) { continue diff --git a/cmd/restore.go b/cmd/restore.go index 9591b044..70ce948e 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -115,7 +115,7 @@ func runRestore(c *cli.Context) error { // Data files if !c.Bool("database-only") { os.MkdirAll(setting.AppDataPath, os.ModePerm) - for _, dir := range []string{"attachments", "avatars"} { + for _, dir := range []string{"attachments", "avatars", "repo-avatars"} { // Skip if backup archive does not have corresponding data srcPath := path.Join(archivePath, "data", dir) if !com.IsDir(srcPath) { diff --git a/cmd/web.go b/cmd/web.go index cd4e49cb..cb17543c 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -64,7 +64,7 @@ func checkVersion() { if err != nil { log.Fatal(2, "Fail to read 'templates/.VERSION': %v", err) } - tplVer := string(data) + tplVer := strings.TrimSpace(string(data)) if tplVer != setting.AppVer { if version.Compare(tplVer, setting.AppVer, ">") { log.Fatal(2, "Binary version is lower than template file version, did you forget to recompile Gogs?") @@ -96,14 +96,14 @@ func newMacaron() *macaron.Macaron { m.Use(macaron.Static( setting.AvatarUploadPath, macaron.StaticOptions{ - Prefix: "avatars", + Prefix: models.USER_AVATAR_URL_PREFIX, SkipLogging: setting.DisableRouterLog, }, )) m.Use(macaron.Static( setting.RepositoryAvatarUploadPath, macaron.StaticOptions{ - Prefix: "repo-avatars", + Prefix: models.REPO_AVATAR_URL_PREFIX, SkipLogging: setting.DisableRouterLog, }, )) -- cgit v1.2.3