Skip to content

Commit f5b43a6

Browse files
zeripathtechknowlogick
authored andcommitted
When redirecting clean the path to avoid redirecting to //www.othersite.com (#5669) (#5703)
Fix #5627 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 1c4293b commit f5b43a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/public/public.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
117117
if fi.IsDir() {
118118
// Redirect if missing trailing slash.
119119
if !strings.HasSuffix(ctx.Req.URL.Path, "/") {
120-
http.Redirect(ctx.Resp, ctx.Req.Request, ctx.Req.URL.Path+"/", http.StatusFound)
120+
http.Redirect(ctx.Resp, ctx.Req.Request, path.Clean(ctx.Req.URL.Path+"/"), http.StatusFound)
121121
return true
122122
}
123123

0 commit comments

Comments
 (0)