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

URL with square brackets #117

Open
kiwifruituk opened this issue Dec 3, 2021 · 2 comments
Open

URL with square brackets #117

kiwifruituk opened this issue Dec 3, 2021 · 2 comments

Comments

@kiwifruituk
Copy link

We've been supplied files from a third party supplier with files that contain square brackets in the name, i.e [root.m].js

This is causing the following error:
Invalid data, parser failed with code 2

As the parsing fails the request.uri returns / and subsequently the resource fails to load.

@masture
Copy link

masture commented Feb 7, 2022

The valid characters in an URI are:

     unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

The other ASCII characters are categorised as following:

      reserved    = gen-delims / sub-delims

      gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
      sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="

This is taken from RFC 3986 (Uniform Resource Identifier (URI): Generic Syntax)

Hence square brackets cannot be used as-is. However these can be used with Percent Encoding.
I don't know whether Telegraph supports Percent Encoding or not. Please try.

@yvbeek
Copy link
Member

yvbeek commented Aug 13, 2022

The URI component is using Apple's URLComponents object to break the string into the relevant parts. I think that this is throwing an error when you use some of these characters.

The C HTTP parser that we're using has some functionality for url parsing, we might be able to use that. Would probably make url parsing faster too

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

3 participants