diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-21 20:02:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 12:02:34 +0000 |
commit | 01500957c29f6bfa2396b8457dbb0645edaafa99 (patch) | |
tree | b5910bfb189c687654b394c22a44ddef1857342c /routers/common | |
parent | 0b4ff15356769db092fd7718da553e8a216c32fa (diff) | |
download | gitea-01500957c29f6bfa2396b8457dbb0645edaafa99.tar.gz gitea-01500957c29f6bfa2396b8457dbb0645edaafa99.zip |
Refactor URL detection (#29960)
"Redirect" functions should only redirect if the target is for current Gitea site.
Diffstat (limited to 'routers/common')
-rw-r--r-- | routers/common/redirect.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/common/redirect.go b/routers/common/redirect.go index 9bf2025e19..34044e814b 100644 --- a/routers/common/redirect.go +++ b/routers/common/redirect.go @@ -17,7 +17,7 @@ func FetchRedirectDelegate(resp http.ResponseWriter, req *http.Request) { // The typical page is "issue comment" page. The backend responds "/owner/repo/issues/1#comment-2", // then frontend needs this delegate to redirect to the new location with hash correctly. redirect := req.PostFormValue("redirect") - if httplib.IsRiskyRedirectURL(redirect) { + if !httplib.IsCurrentGiteaSiteURL(redirect) { resp.WriteHeader(http.StatusBadRequest) return } |