From 7045794c8eeacd7f7c2f0db11042d459f3044486 Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 5 May 2020 19:30:19 +1200 Subject: [PATCH] handle path encoding for repository names containing special characters --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d49d4df..7282f47 100644 --- a/main.go +++ b/main.go @@ -301,7 +301,14 @@ func (this *Application) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - this.Repopage(w, r, parts[1]) + // Proper decoding of special characters in repo path component + repoName, err := url.PathUnescape(parts[1]) + if err != nil { + http.Error(w, "malformed url encoding in repository name", 400) + return + } + + this.Repopage(w, r, repoName) } else if r.URL.Path == `/static/logo.png` { if this.cfg.Template.CustomLogoPngBase64 != "" {