Hacker News new | ask | show | jobs
by Eiim 883 days ago
There's a bit of a "bug" I found where Bernard interprets backslashes in file paths literally and URL-encodes them as %5C, whereas modern browsers automatically correct them to /. You could definitely argue that the URL is specified wrong (assuming that / was indeed intended) but it causes inconsistencies between Bernard and an actual user.
1 comments

Can you share an example, please?

I've had a lot of URL encoding-related issues in the past 24 hours, due to Elixir's URI library being a little too strict, and a lot of websites having broken links that browsers are able to work around and interpret just fine. I reckon I will have to spend my weekend writing a bespoke URL encoder/decoder.

Sure, the images on this page are where I noticed it: https://chainswordcs.com/e-reader-protos.html

No doubt URL encoding is frustrating, good luck taking it on!

Yeah, the paths on that page are encoded with a backslash, which browsers seem to correct to a forward slash, as they should be.

I'll add those in my test suite and fix them soon, thanks. Indeed Bernard should be able to replicate the behaviour of any browser, however broken the links are. If it works in your browser, it should work in Bernard.

BTW, even curl seems to have issues with those links:

    > GET /e-reader-protos\March-7-2001-Press-Conference-photo-1.jpg HTTP/1.1
    > Host: chainswordcs.com
    > User-Agent: curl/8.2.1
    > Accept: */*
    >
    * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    * old SSL session ID is stale, removing
    < HTTP/1.1 404 Not Found