mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	When redirecting clean the path to avoid redirecting to //www.othersite.com (#5669)
Fix #5627 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -117,7 +117,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
 | 
				
			|||||||
	if fi.IsDir() {
 | 
						if fi.IsDir() {
 | 
				
			||||||
		// Redirect if missing trailing slash.
 | 
							// Redirect if missing trailing slash.
 | 
				
			||||||
		if !strings.HasSuffix(ctx.Req.URL.Path, "/") {
 | 
							if !strings.HasSuffix(ctx.Req.URL.Path, "/") {
 | 
				
			||||||
			http.Redirect(ctx.Resp, ctx.Req.Request, ctx.Req.URL.Path+"/", http.StatusFound)
 | 
								http.Redirect(ctx.Resp, ctx.Req.Request, path.Clean(ctx.Req.URL.Path+"/"), http.StatusFound)
 | 
				
			||||||
			return true
 | 
								return true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user