Skip to content

Commit

Permalink
When redirecting clean the path to avoid redirecting to //www.othersi…
Browse files Browse the repository at this point in the history
…te.com (go-gitea#5669)

Fix go-gitea#5627

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Jan 9, 2019
1 parent 41a2bfe commit f83bc1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
if fi.IsDir() {
// Redirect if missing trailing slash.
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
}

Expand Down

0 comments on commit f83bc1d

Please sign in to comment.