akka/akka-http

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

Open

#2,577 opened on Jun 25, 2019

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Scala (598 forks)batch import
1 - triageddiscusshelp wantedt:coret:docst:model

Repository metrics

Stars
 (1,311 stars)
PR merge metrics
 (Avg merge 1d 10h) (2 merged PRs in 30d)

Description

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.

Contributor guide