404 Page Breaks when .js is added to the end of a user page

Not a very important bug, but upon visiting a user page on the forum with .js on the end that does not exist, the CSS does not render.

1 Like

@RiversideRocks is not expecting data to be returned.

He is simply pointing out that when a link (as he posted) has a .js extension, that the 404 pages is not displayed as expected, hence his topic:

Screen Shot 2020-08-23 at 1.29.19 PM

Seems legit that a properly formatted 404 page should be returned when the extension is wrong (in this case .js), because when other extensions are used (see .xml) example, the 404 page is formatted correctly:

@RiversideRocks is simply pointing out that when a .js extension is processed as a 404 (file not found), it the 404 page is not formatted nicely, as expected.

3 Likes

Yup you are right. And the OP is right too.

It’s a curious discrepancy. I would like to understand why this is happening.

Out of interest, why are people trying to open these kind of .js routes in the first place?

3 Likes

I think, at high level (not being an Ember person at all, so just talking in general), the reason it happens is that Discourse tries to load the file with the .js extension and so there is a javascript 404 error in the console and this causes the Discourse Ember 404 page to fail to load completely (the JS fails).

So, the normal 404 page loads but because it is a JS error (because there is also a 404 JS loading error), it does not render in it’s normal pretty way.

3 Likes

I was wondering if it had something to do with the headers discourse sends out if it detects a .js file ending, but that sounds correct.

Hey @RiversideRocks

If it really bothers you, you could add your own CSS to style that page so when the JS fails, it will still look pretty :slight_smile:

But like @merefield mentioned, why worry about it since that is not a normal or supported link / route ?

2 Likes

I never thought much of it, I just thought that it was a neat bug and wanted to share.

3 Likes