Repository navigation
Answer missing files with 404 instead of the index page - #3
Merged
Merged
Conversation
The static web server sent the entrypoint for every path it could not
find, so a request for a file that does not exist came back as the HTML
page with a 200. Tested on a phone against the Static Website template:
GET /missing.css -> 200, Content-Type: text/html
A typo in a stylesheet or script path therefore broke the page with no
error anywhere. The single-page-app fallback is worth keeping for routes
like /dashboard, so it now applies only to paths whose last segment has
no extension. A path that names a file resolves to that file, and the
caller turns a file that does not exist into a 404.
Covered by StaticWebRoutingTest: the entrypoint for / and for routes,
real files for real paths, a missing file for /missing.css and
/assets/nope.js, and null (403) for paths that escape the source folder.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while testing v1.4.0 on a Galaxy S9. The static web server answered every unknown path with the entrypoint, so a missing asset came back as HTML with a 200:
A typo in an asset path broke the page silently. The SPA fallback is still right for routes (
/dashboard), so it now applies only when the last path segment has no extension; anything that names a file resolves to that file, and a file that does not exist becomes a 404.Path traversal still returns 403,
HEADstill works, and non-GET/HEAD still returns 405 — unchanged.New
StaticWebRoutingTestlocks in: entrypoint for/and for extension-less routes, real files for real paths, a non-existent file for/missing.cssand/assets/nope.js, and null for paths escaping the source folder.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests