akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/docs/akka-http
Other
1.34k stars 596 forks source link

Uri.Path() is ambiguous about accepting % encoded vs not encoded #2577

Open jsweet-datto opened 5 years ago

jsweet-datto commented 5 years ago

If you put characters that should be percent-encoded in a string passed to Uri.Path(), it will automatically percent-encode them (e.g. turn a space into %20). Unless the character itself is a percent, in which case it assumes you are trying to percent encode this. I guess this is sort of by design, but the ambiguity definitely can create bugs. Ideally there'd be two variants you could pass to, one that expected unencoded input and encoded everything (including %), and another that expects encoded input and rejects characters that need to be percent-encoded.

jrudolph commented 5 years ago

Thanks for the report, @jsweet-datto. I agree it can be confusing. I think we would need some concrete proposals about what could be changed.

vasiliybondarenko commented 5 years ago

Can anyone take a look at my approach in linked PR? If the approach is ok I'll fix the PR to meet all requirements