Skip to content
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

Colons in path are escaped #55

Closed
BrechtSerckx opened this issue Oct 3, 2022 · 2 comments · Fixed by #58
Closed

Colons in path are escaped #55

BrechtSerckx opened this issue Oct 3, 2022 · 2 comments · Fixed by #58
Labels

Comments

@BrechtSerckx
Copy link

Version: modern-uri-0.3.4.4 (also occurs on older)

Colons in path pieces are percent-encoded, while it seems to me from https://www.rfc-editor.org/rfc/rfc3986#section-3.3 that they can appear unencoded from the second path piece on.

[nix-shell:~/]$ ghci
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> import Data.Text
ghci> import Text.URI
ghci> Right u = mkURI (pack "https://mybusinessbusinessinformation.googleapis.com/v1/categories:batchGet")
ghci> render u
"https://mybusinessbusinessinformation.googleapis.com/v1/categories%3abatchGet"

This gives issues with f.e. Google, which uses colons in paths but does not accept the percent-encoded variant.

@mrkkrp
Copy link
Owner

mrkkrp commented Oct 4, 2022

RFC 3986 is quite dense. It looks like unless a URI is a "Relative Reference" (basically it is something without a scheme), then : is allowed in path segments. Otherwise it is forbidden in the very first segment, which makes sense because in that case the prefix (everything before :) could start looking like a scheme 🤔

Frankly, I think it is admissible to just allow : to be unescaped. I may get to doing it myself, but you are welcome to open a PR if you want to speed things up.

@mrkkrp
Copy link
Owner

mrkkrp commented Oct 27, 2022

This should be fixed now. 0.3.6.0 is on Hackage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants