diff options
author | zeripath <art27@cantab.net> | 2019-05-27 22:08:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 22:08:38 +0100 |
commit | 69d81b656978a03ff277a611f5c3d9ef1814d001 (patch) | |
tree | 57e6bbaa990551b646dfbd3c7d965450d5754f54 /modules/util | |
parent | 9ca7fcddbb4c9aba7a3f8e84f6c63b7504837bee (diff) | |
download | gitea-69d81b656978a03ff277a611f5c3d9ef1814d001.tar.gz gitea-69d81b656978a03ff277a611f5c3d9ef1814d001.zip |
Handle insecure and ports in go get (#7041)
* Handle insecure and ports in go get
* Fix IsExternalURL for non-standard ports
Diffstat (limited to 'modules/util')
-rw-r--r-- | modules/util/url.go | 3 | ||||
-rw-r--r-- | modules/util/util_test.go | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/util/url.go b/modules/util/url.go index 537e4c9b52..263255fcd3 100644 --- a/modules/util/url.go +++ b/modules/util/url.go @@ -52,7 +52,8 @@ func IsExternalURL(rawURL string) bool { if err != nil { return true } - if len(parsed.Host) != 0 && strings.Replace(parsed.Host, "www.", "", 1) != strings.Replace(setting.Domain, "www.", "", 1) { + appURL, _ := url.Parse(setting.AppURL) + if len(parsed.Host) != 0 && strings.Replace(parsed.Host, "www.", "", 1) != strings.Replace(appURL.Host, "www.", "", 1) { return true } return false diff --git a/modules/util/util_test.go b/modules/util/util_test.go index 3a2b4b71ff..2475065059 100644 --- a/modules/util/util_test.go +++ b/modules/util/util_test.go @@ -46,7 +46,7 @@ func TestURLJoin(t *testing.T) { } func TestIsExternalURL(t *testing.T) { - setting.Domain = "try.gitea.io" + setting.AppURL = "https://try.gitea.io" type test struct { Expected bool RawURL string |