mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Refactor AppURL usage (#30885)
Fix #30883 Fix #29591 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
		@@ -254,7 +254,7 @@ func (b *Base) Redirect(location string, status ...int) {
 | 
			
		||||
		code = status[0]
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if strings.HasPrefix(location, "http://") || strings.HasPrefix(location, "https://") || strings.HasPrefix(location, "//") {
 | 
			
		||||
	if !httplib.IsRelativeURL(location) {
 | 
			
		||||
		// Some browsers (Safari) have buggy behavior for Cookie + Cache + External Redirection, eg: /my-path => https://other/path
 | 
			
		||||
		// 1. the first request to "/my-path" contains cookie
 | 
			
		||||
		// 2. some time later, the request to "/my-path" doesn't contain cookie (caused by Prevent web tracking)
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ func (ctx *Context) RedirectToCurrentSite(location ...string) {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if !httplib.IsCurrentGiteaSiteURL(loc) {
 | 
			
		||||
		if !httplib.IsCurrentGiteaSiteURL(ctx, loc) {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user