From 8b92f9cca6c28bc8ba894ed224a7a8bbf31a0ba6 Mon Sep 17 00:00:00 2001 From: Matthias Pioch Date: Sat, 24 Oct 2015 22:46:13 +0200 Subject: [PATCH] fix workaround for reverse proxy, ssh, submodule --- modules/base/template.go | 3 --- modules/git/submodule.go | 7 ++++--- templates/repo/view_list.tmpl | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/base/template.go b/modules/base/template.go index a93d20ad8..f5f567ade 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -141,9 +141,6 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ "AppName": func() string { return setting.AppName }, - "AppUrl": func() string { - return setting.AppUrl - }, "AppSubUrl": func() string { return setting.AppSubUrl }, diff --git a/modules/git/submodule.go b/modules/git/submodule.go index 1291e112b..0b8efc26d 100644 --- a/modules/git/submodule.go +++ b/modules/git/submodule.go @@ -6,6 +6,7 @@ package git import ( "strings" + "github.com/gogits/gogs/modules/setting" ) type SubModule struct { @@ -30,7 +31,7 @@ func NewSubModuleFile(c *Commit, refUrl, refId string) *SubModuleFile { } // RefUrl guesses and returns reference URL. -func (sf *SubModuleFile) RefUrl(appUrl string) string { +func (sf *SubModuleFile) RefUrl() string { if sf.refUrl == "" { return "" } @@ -52,8 +53,8 @@ func (sf *SubModuleFile) RefUrl(appUrl string) string { j := strings.LastIndex(url, ":") if i > -1 && j > -1 { // fix problem with reverse proxy works only with local server - if strings.Contains(appUrl,url[i+1:j]) { - return appUrl + url[j+1:] + if strings.Contains(setting.AppUrl,url[i+1:j]) { + return setting.AppUrl + url[j+1:] } else { return "http://" + url[i+1:j] + "/" + url[j+1:] } diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index bebac1ea4..d3303193f 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -39,8 +39,8 @@ - {{if $commit.RefUrl AppUrl}} - {{$entry.Name}} @ {{ShortSha $commit.RefId}} + {{if $commit.RefUrl}} + {{$entry.Name}} @ {{ShortSha $commit.RefId}} {{else}} {{$entry.Name}} @ {{ShortSha $commit.RefId}} {{end}}