-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path should also be escaped #25
Comments
This bug bit us as well, we were using an email address as a path param and it was working for simple cases, but not when there was a This is the spec section for this piece that mentions percent encoding the path segements. |
This caused a bug in my code. The behavior directly contradicts the documentation. |
Upvote. This also caused a bug in my code. The part of the documentation that says it escapes is in the function you ultimately need to use to fix your url https://package.elm-lang.org/packages/elm/url/latest/Url#percentEncode I will say that it DOES escape query parameters... but if you are building an API url for example and some parameters are path params (as they often are) and they contain spaces (as they sometimes do), this bug will get you. |
If the proposed fix is to call UB.absolute ["искать", "книги"] []
-- current: "/искать/книги"
-- proposed: "/%D0%B8%D1%81%D0%BA%D0%B0%D1%82%D1%8C/%D0%BA%D0%BD%D0%B8%D0%B3%D0%B8"
UB.absolute ["søg", "bøger"] []
-- current: "/søg/bøger"
-- proposed: "/s%C3%B8g/b%C3%B8ger"
So the current defaults assume that wanting UTF-8 chars in a path is more common than having path segments that contain The meta issue #42 attempts to summarize the options and solicit examples and evidence that could inform any future change. |
Thought about this: ["søg", "bø/ger"].map(a => a.split("").map(v => v.charCodeAt(0) < 128 ? encodeURIComponent(v) : v).join("")).join("/") Produces:
|
should result to
but currently results to
This is especially surprising due to documentation
The text was updated successfully, but these errors were encountered: