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

Chokes on URL with + sign #408

Closed
hasufell opened this issue Aug 4, 2022 · 9 comments
Closed

Chokes on URL with + sign #408

hasufell opened this issue Aug 4, 2022 · 9 comments

Comments

@hasufell
Copy link
Member

hasufell commented Aug 4, 2022

In GitLab by @ulysses4ever on Aug 5, 2022, 06:34

Doing

ghcup install ghc -u "https://gitlab.haskell.org/api/v4/projects/1/jobs/1129565/artifacts/ghc-x86_64-linux-alpine3_12-validate+fully_static.tar.xz" mr7847

I get an error:

[ Error ] Download failed: Process "curl" with arguments ["-fL", "-o",
[ ...   ]                                                 "/home/artem/.ghcup/tmp/ghcup-5295ff1124c7a668/ghc-x86_64-linux-alpine3_12-validate fully_static.tar.x.tmp",
[ ...   ]                                                 "https://gitlab.haskell.org/api/v4/projects/1/jobs/1129565/artifacts/ghc-x86_64-linux-alpine3_12-validate%20fully_static.tar.xz"] failed with exit code 22.

Notice how URL got changed: instead of + I now have a 'Reference to deleted milestone 20'.

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @maerwald on Aug 5, 2022, 09:56

Did you try with url encoding [0.1.10](https://github.com/haskell/ghcup-hs/milestone/2)B?

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @maerwald on Aug 5, 2022, 10:01

This works for me. So it's not really a bug. We just expect properly url encoded urls.

Accepting these types of URLs is an enhancement.

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @ulysses4ever on Aug 5, 2022, 10:09

Good point, thank you.

I think silently replacing + with 'Reference to deleted milestone 20' is a bug though. Correct behavior would be to abort and signal about unexpected symbol in the URL.

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @maerwald on Aug 5, 2022, 10:49

I'm on company network, so can't do much investigation now.

Check:

So when we read from optparse, we use parseURI strictURIParserOptions . UTF8.fromString.

When we pass to curl, we do decUTF8Safe . serializeURIRef'

uri-bytestring docs:

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @maerwald on Aug 5, 2022, 11:03

This seems to be correct behavior: https://www.w3schools.com/tags/ref_urlencode.asp

URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with 'Reference to deleted milestone 20'.

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @maerwald on Aug 5, 2022, 11:15

Soostone/uri-bytestring#55

@hasufell
Copy link
Member Author

hasufell commented Aug 5, 2022

In GitLab by @ulysses4ever on Aug 5, 2022, 11:24

Very interesting, thank you for the investigation.

I guess, feel free to close as an upstream bug…

@hasufell
Copy link
Member Author

hasufell commented Jan 2, 2024

I actually changed my mind and I believe my PR fixes this: Soostone/uri-bytestring#64

RFC 3986 does not specify that + should be replaced with anything. Some HTLM encoding standards seem to specify that, but just for the query part, not the path part.

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

No branches or pull requests

1 participant