mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 11:07:20 +00:00
Refactor external URL detection (#29973)
Follow #29960, `IsExternalURL` is not needed anymore. Add some tests for `RedirectToCurrentSite`
This commit is contained in:
@ -32,9 +32,11 @@ func IsCurrentGiteaSiteURL(s string) bool {
|
||||
return false
|
||||
}
|
||||
if u.Path != "" {
|
||||
u.Path = "/" + util.PathJoinRelX(u.Path)
|
||||
if !strings.HasSuffix(u.Path, "/") {
|
||||
u.Path += "/"
|
||||
cleanedPath := util.PathJoinRelX(u.Path)
|
||||
if cleanedPath == "" || cleanedPath == "." {
|
||||
u.Path = "/"
|
||||
} else {
|
||||
u.Path += "/" + cleanedPath + "/"
|
||||
}
|
||||
}
|
||||
if urlIsRelative(s, u) {
|
||||
|
Reference in New Issue
Block a user