From 98ad7f279c6b78f1a09c8a60dc54760b3bcfabfe Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 13 Jul 2021 15:24:37 -0700 Subject: [PATCH] ipn/localapi: fix inability to receive taildrop files w/ escaped names The localapi was double-unescaping: once by net/http populating the URL, and once by ourselves later. We need to start with the raw escaped URL if we're doing it ourselves. Started to write a test but it got invasive. Will have to add those tests later in a commit that's not being cherry-picked to a release branch. Fixes #2288 Signed-off-by: Brad Fitzpatrick --- ipn/localapi/localapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index 49c05f214..742c27926 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -266,7 +266,7 @@ func (h *Handler) serveFiles(w http.ResponseWriter, r *http.Request) { http.Error(w, "file access denied", http.StatusForbidden) return } - suffix := strings.TrimPrefix(r.URL.Path, "/localapi/v0/files/") + suffix := strings.TrimPrefix(r.URL.EscapedPath(), "/localapi/v0/files/") if suffix == "" { if r.Method != "GET" { http.Error(w, "want GET to list files", 400)