|
|
|
@ -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:] |
|
|
|
|
} |
|
|
|
|