use EscapedPath instead of Path
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 195
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Way can't distinguish between / and %2F in a path. Thus %2F messes up the path segments.
I'd suggest to fix this by using u.EscapedPath() instead of req.URL.Path. Quoting net/url#URL:
Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use the EscapedPath method, which preserves the original encoding of Path.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Find where the router uses req.URL.Path to split or match request path segments, then compare that handling with Go's net/url URL.EscapedPath documentation. The change is done when encoded slashes such as %2F remain distinguishable from literal slashes during routing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100