Is it possible to force the %-encoding of `+`?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
- Note that this crate implements the URL Standard not RFC 1738 or RFC 3986
(but I'm hoping ...)
Describe the bug
This code sample, which is clearly standards-correct behavior emits https://example.com/foo+bar:
let mut url = Url::parse("https://example.com/").unwrap();
url.path_segments_mut().unwrap().push("foo+bar");
println!("{}", url);
However, some systems like AWS S3 incorrectly interpret +'s in the path to be spaces:
$ curl 'https://xxx.s3.amazonaws.com/v0.15.1+xxx/xxx'
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>.
<Key>v0.15.1 xxx/xxx</Key>
...
</Error>
S3 does decode a %2B as a +, like I'm hoping for.
This puts me in a pickle about how to do this. If I url-encode the + before passing it to URL, it gets (again, properly) encoded to %252B, but S3 doesn't understand that obviously.
Is there a way to get the behavior I'm looking for? Would I have to get the path implement my own string replacement of + with %2B?
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
Start with the path_segments_mut() entry point and the provided Rust reproduction, then inspect how the URL is serialized after pushing foo+bar. Compare the current output with S3's %2B expectation; done should establish whether the crate can support this encoding or clearly document the required behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100