+2
-2
appview/state/middleware.go
+2
-2
appview/state/middleware.go
···
165
165
166
166
func StripLeadingAt(next http.Handler) http.Handler {
167
167
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
168
-
path := req.URL.Path
168
+
path := req.URL.EscapedPath()
169
169
if strings.HasPrefix(path, "/@") {
170
-
req.URL.Path = "/" + strings.TrimPrefix(path, "/@")
170
+
req.URL.RawPath = "/" + strings.TrimPrefix(path, "/@")
171
171
}
172
172
next.ServeHTTP(w, req)
173
173
})
+3
knotserver/routes.go
+3
knotserver/routes.go
···
10
10
"fmt"
11
11
"log"
12
12
"net/http"
13
+
"net/url"
13
14
"os"
14
15
"path/filepath"
15
16
"strconv"
···
34
35
path, _ := securejoin.SecureJoin(h.c.Repo.ScanPath, didPath(r))
35
36
l := h.l.With("path", path, "handler", "RepoIndex")
36
37
ref := chi.URLParam(r, "ref")
38
+
ref, _ = url.PathUnescape(ref)
37
39
38
40
gr, err := git.Open(path, ref)
39
41
if err != nil {
···
148
150
func (h *Handle) RepoTree(w http.ResponseWriter, r *http.Request) {
149
151
treePath := chi.URLParam(r, "*")
150
152
ref := chi.URLParam(r, "ref")
153
+
ref, _ = url.PathUnescape(ref)
151
154
152
155
l := h.l.With("handler", "RepoTree", "ref", ref, "treePath", treePath)
153
156