Monorepo for Tangled tangled.org

appview: path-escape all refs passed between appview & knotserver

Changed files
+8 -2
appview
knotserver
+1 -1
appview/state/pull.go
··· 779 779 return 780 780 } 781 781 782 - hiddenRef := url.QueryEscape(fmt.Sprintf("hidden/%s/%s", sourceBranch, targetBranch)) 782 + hiddenRef := fmt.Sprintf("hidden/%s/%s", sourceBranch, targetBranch) 783 783 // We're now comparing the sourceBranch (on the fork) against the hiddenRef which is tracking 784 784 // the targetBranch on the target repository. This code is a bit confusing, but here's an example: 785 785 // hiddenRef: hidden/feature-1/main (on repo-fork)
+1 -1
appview/state/signer.go
··· 328 328 Method = "GET" 329 329 ) 330 330 331 - endpoint := fmt.Sprintf("/%s/%s/branches/%s", ownerDid, repoName, branch) 331 + endpoint := fmt.Sprintf("/%s/%s/branches/%s", ownerDid, repoName, url.PathEscape(branch)) 332 332 333 333 req, err := us.newRequest(Method, endpoint, nil) 334 334 if err != nil {
+6
knotserver/routes.go
··· 461 461 func (h *Handle) Branch(w http.ResponseWriter, r *http.Request) { 462 462 path, _ := securejoin.SecureJoin(h.c.Repo.ScanPath, didPath(r)) 463 463 branchName := chi.URLParam(r, "branch") 464 + branchName, _ = url.PathUnescape(branchName) 465 + 464 466 l := h.l.With("handler", "Branch") 465 467 466 468 gr, err := git.PlainOpen(path) ··· 829 831 l := h.l.With("handler", "NewHiddenRef") 830 832 831 833 forkRef := chi.URLParam(r, "forkRef") 834 + forkRef, _ = url.PathUnescape(forkRef) 835 + 832 836 remoteRef := chi.URLParam(r, "remoteRef") 837 + remoteRef, _ = url.PathUnescape(remoteRef) 838 + 833 839 path, _ := securejoin.SecureJoin(h.c.Repo.ScanPath, didPath(r)) 834 840 gr, err := git.PlainOpen(path) 835 841 if err != nil {