Change of URL encoding behaviour doesn't seem right
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
This issue is probably related to #1189 but is focused on the encoding of path variables instead. We've recently upgraded to Spring Cloud to Hoxton.SR3 which includes a bump of Spring Cloud OpenFeign from 2.2.1.RELEASE to 2.2.2.RELEASE. This patch version bumps OpenFeign from 10.4.0 to 10.7.4 which seems to contain quite a few important changes.
In particular, there is a change of behaviour around url encoding (#1138) which in our case has broken a couple of things with using path variables. I've created a sandbox project at https://github.com/sguillope/openfeign-url-encoding-issue to make it easier to reproduce the issue.
The 2 problems we've hit are as follows when using a path variable:
- The colon
:character now gets url-encoded to%3A. While not really incorrect, it's not actually required as a colon is a valid character in a path segment (https://tools.ietf.org/html/rfc3986#section-3.3), except for one case which shouldn't apply here. This only broke our integration tests, not production code, so we can easily fix that. - The most problematic one is the handling of the forward slash
/character. With the latest version, it doesn't get url-encoded in path variables. Fortunately this was caught by our integration tests, otherwise it would have broken our production code. We can't pre-encode it because it will then get double-encoded as%252Finstead of%2F.
To summarise:
| Input | Result | Expected |
|---|---|---|
a:path/variable |
a%3Apath/variable |
a:path%2Fvariable |
path/variable |
path/variable |
path%2Fvariable |
a:path |
a%3Apath |
a:path |
Let me know if you need more details.
Thanks
Contributor guide
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
Start with the linked sandbox project and compare its path-variable encoding with the examples in this issue, while reviewing the related changes in #1189 and #1138. Done means colon handling matches the expected URLs and forward slashes are encoded as %2F without double encoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100