mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 20:32:11 +00:00
Handle insecure and ports in go get (#7041)
* Handle insecure and ports in go get * Fix IsExternalURL for non-standard ports
This commit is contained in:
parent
9ca7fcddbb
commit
69d81b6569
4 changed files with 16 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue