A minor bug report with 404 page


#1

Hello,

As i was browsing brave.com site. i found a small minor bug in 404 error page.
If you navigate to ‘https://brave.com/sdfsdf/sdfsf/sdf’ the page is completely broken. This bug has to do with the amount of slashes in the URL, seems that bug occurs when you put 3 or more slashes in the URL path after the domain name. Its a small minor bug, not that important but detail makes difference right?

Thanks a lot for reading,
Stefanos Vichas.


#2

Nice find, thanks :smile:


#3

Good catch! Looks like we’re able to locate and load our CSS as long as the path contains only a single directory. For instance, /foo/ will work, while /foo/bar will not. Here are a couple URLs for example:

The issue here may be with how we’re references our CSS. Looks like we’re using relative paths. Just to confirm, the ran the following from the developer tools of a broken page:

// Get all of our stylesheets
Array.from(document.querySelectorAll('link[rel=stylesheet]')).forEach(element => {
    // Get the href for the current stylesheet
    let href = element.getAttribute('href')
    // If it starts with a relative 'css/' path, change to an absolute
    if (href.match(/^css/)) {
		element.setAttribute('href', href.replace(/^css/, '/css'))
    }
})

This appears to resolve the issue.

Images also appear to be using relative paths, which breaks the Brave logo on some 404 pages too.


#4

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.