serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Ladybird: URL with %23 in it won't load

Open elisee opened this issue 1 year ago β€’ 1 comments

When navigating to the following URL in Ladybird (usually loaded from here: https://sparklinlabs.itch.io/):

https://img.itch.zone/aW1hZ2UvNTI3NjAvMjM0MTA4LmdpZg==/315x250%23cm/j8SPxj.gif 

The server returns an HTTP 404 error instead of the expected GIF, like in other browsers.

As far as I can tell, the culprit is our handling of the percent-encoded # (%23) found in the path.

elisee avatar Feb 27 '24 20:02 elisee

I have a patch here: https://github.com/elisee/serenity/commit/956fca4b79a3ff87144d1277fe3deece41e6dbda which fixes the issue but I don't think it's quite correct.

From what I read in https://datatracker.ietf.org/doc/html/rfc3986#section-2.4, our URL path shouldn't need to be percent-decoded because it shouldn't be percent-encoded while stored in the URL class in the first place (but it currently is). So my patch removes the percent-decoding and then does a percent-encoding in "path mode" because... that sounded good? but seems that's just a hack that happens to work. Anyway, I'm running out of time for now, but after applying the above patch:

  • This now works: https://img.itch.zone/aW1hZ2UvNTI3NjAvMjM0MTA4LmdpZg==/315x250%23cm/j8SPxj.gif
  • This used to work, and still works: https://demo.cyotek.com/features/sub%20folder/page%20with%20spaces.php
  • Browsing a few pages seem to work as usual.

Hope it helps if someone wants to dig into this further before I get the chance.

elisee avatar Feb 27 '24 21:02 elisee

Please move this issue to https://github.com/LadybirdBrowser/ladybird if it’s still relevant.

kleinesfilmroellchen avatar Jul 02 '24 06:07 kleinesfilmroellchen