summaryrefslogtreecommitdiffstats
path: root/modules/util/url.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/util/url.go')
-rw-r--r--modules/util/url.go18
1 files changed, 0 insertions, 18 deletions
diff --git a/modules/util/url.go b/modules/util/url.go
index 263255fcd3..96c66df92b 100644
--- a/modules/util/url.go
+++ b/modules/util/url.go
@@ -8,9 +8,6 @@ import (
"net/url"
"path"
"strings"
-
- "code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/setting"
)
// PathEscapeSegments escapes segments of a path while not escaping forward slash
@@ -30,13 +27,11 @@ func URLJoin(base string, elems ...string) string {
}
baseURL, err := url.Parse(base)
if err != nil {
- log.Error("URLJoin: Invalid base URL %s", base)
return ""
}
joinedPath := path.Join(elems...)
argURL, err := url.Parse(joinedPath)
if err != nil {
- log.Error("URLJoin: Invalid arg %s", joinedPath)
return ""
}
joinedURL := baseURL.ResolveReference(argURL).String()
@@ -45,16 +40,3 @@ func URLJoin(base string, elems ...string) string {
}
return joinedURL
}
-
-// IsExternalURL checks if rawURL points to an external URL like http://example.com
-func IsExternalURL(rawURL string) bool {
- parsed, err := url.Parse(rawURL)
- if err != nil {
- return true
- }
- 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
-}