diff options
author | zeripath <art27@cantab.net> | 2019-01-09 18:39:01 +0000 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2019-01-09 13:39:01 -0500 |
commit | dd13327382f76b7a5d2b5e98e75a6aaa9a67c313 (patch) | |
tree | 5cb09ccc927d2a1f3166ccf9f8d57e915dca71f7 /modules/public | |
parent | 0b84b5ee4956e0da5a98d8a7707481a2832bb9fc (diff) | |
download | gitea-dd13327382f76b7a5d2b5e98e75a6aaa9a67c313.tar.gz gitea-dd13327382f76b7a5d2b5e98e75a6aaa9a67c313.zip |
When redirecting clean the path to avoid redirecting to //www.othersite.com (#5669)
Fix #5627
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/public')
-rw-r--r-- | modules/public/public.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/public/public.go b/modules/public/public.go index f03f8fcc15..2e004536f8 100644 --- a/modules/public/public.go +++ b/modules/public/public.go @@ -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 } |