From 71799c83460e037f1af9c4e89a66d9f1f6860cad Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Tue, 18 Mar 2025 22:37:52 +0200 Subject: [PATCH] knotserver: urldecode refs --- knotserver/routes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/knotserver/routes.go b/knotserver/routes.go index 2929953..625c1aa 100644 --- a/knotserver/routes.go +++ b/knotserver/routes.go @@ -183,6 +183,7 @@ func (h *Handle) RepoTree(w http.ResponseWriter, r *http.Request) { func (h *Handle) Blob(w http.ResponseWriter, r *http.Request) { treePath := chi.URLParam(r, "*") ref := chi.URLParam(r, "ref") + ref, _ = url.PathUnescape(ref) l := h.l.With("handler", "FileContent", "ref", ref, "treePath", treePath) @@ -333,6 +334,7 @@ func (h *Handle) Log(w http.ResponseWriter, r *http.Request) { func (h *Handle) Diff(w http.ResponseWriter, r *http.Request) { ref := chi.URLParam(r, "ref") + ref, _ = url.PathUnescape(ref) l := h.l.With("handler", "Diff", "ref", ref) @@ -491,7 +493,6 @@ func (h *Handle) NewRepo(w http.ResponseWriter, r *http.Request) { return } - log.Println("branch", data.DefaultBranch) if data.DefaultBranch == "" { data.DefaultBranch = h.c.Repo.MainBranch } -- 2.51.2