chore (frontend): return 404 instead of index.html on requests for non existing assets - #240
Conversation
….html for non existing assets
|
Thanks for chasing this down — the MIME type "text/html" diagnosis is spot on, and the /assets/* → 404 change plus the tests are good. One blocker: the hash bump doesn't fix the root cause, and it's why CI is red. dist/assets/ is gitignored — only the placeholder index.html is tracked (.gitignore + the assets.go doc comment). So a committed real index.html always references assets that aren't in git; swapping one hash for another just moves the dangling reference. CI never runs npm run build (ci.yml), so TestFrontend_DistIndexReferencesExistingAssets runs against a dist/ with no assets/ and fails on all three refs. |
|
@elfedy Thanks for your contribution. We have fixed the regression in an earlier PR and you can find it here: I also added a nicer instruction for testing or running UI in dev environment: #255. Plesae check if that helps! I will be happy to approve this PR once the conflicts are fixed. |
|
@srikanth-bitdynamics @zheli thanks for the comments, makes sense. Removed the regression fix attempt and kept the 404 behavior when serving assets. Will also rename the PR to better reflect the change. |
|
Merged. Thank you for your contribution @elfedy ! |
Current
index.htmlreferences an outdated asset file. On the browser, the error returned was:The error makes debugging confusing as the real reason for the failure is that the asset file does not exist. Returning a resource that is not the one requested is also non REST-like behavior and should be avoided when possible.
This PR updates the outdated reference and adds:
404error when looking for a file in theassetsdirectory.TestFrontend_DistIndexReferencesExistingAssetstest to make sure the index does not reference non existing assets