Skip to content

Commit

Permalink
ipn/localapi: fix inability to receive taildrop files w/ escaped names
Browse files Browse the repository at this point in the history
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 <bradfitz@tailscale.com>
  • Loading branch information
bradfitz committed Jul 13, 2021
1 parent 73f8aee commit c395408
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ipn/localapi/localapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c395408

Please sign in to comment.