Repository navigation
Strip the inherited /null/ path prefix before route matching - #75
Merged
Merged
Conversation
The alias rewrite lived at the end of the request handler, after the `/` and `/editor` rewrites, the readOnly JSON table, the template-source route and the `/api/` guard had all been skipped. A `/null/...` link therefore only ever reached serveFile, so `/null/health`, `/null/api/v1/templates`, `/null/api/references`, `/null/editor` and `/null/media/references/*.mp4` all 404'd. `/null` also assigned `pathname = '/'` after the `'/' -> '/demo.html'` rewrite had already passed, so it fell through to the directory index and served the template gallery instead of the homepage. Move the two lines to just after the pathname sanity checks so every later branch sees the stripped path, and normalize `/null` and `/null/` to `/` so they pick up the demo.html rewrite. Refs blixvip#57
Owner
|
Merged, thanks @hussain-alsaibai! Locally If you'd like another, #68 (keep the preview Play/Pause button label in sync with the film) is a small UI-state fix. |
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.
Summary
server.jsrewrote/nulland/null/...back onto the real routes, but therewrite sat at the end of the handler — after the
/and/editorrewrites,the
readOnlyJSON table, the template-source route and the/api/guard hadalready been skipped. The prefix therefore only ever reached
serveFile, soevery inherited link 404'd.
The same ordering broke
/nullitself:pathname = '/'was assigned afterthe
'/' -> '/demo.html'rewrite had passed, so it fell through to thedirectory index and served the template gallery instead of the homepage.
This moves the two lines to just after the pathname sanity checks, so every
later branch sees the already-stripped path.
/nulland/null/normalize to/so they pick up thedemo.htmlrewrite. The rest of the handler isuntouched.
Verification
Live
createApp()before the change, as reported in the issue:/null/health/null/api/v1/templates/null/api/references/null/editor/null/media/references/227b019e7968.mp4/nulltitle/null/titleAdded
inherited /null/ path prefix is stripped before route matchingtotest/server.test.js, covering all five routes plus thedemo.htmlvsindex.htmltitle distinction. The test fails onorigin/mainand passeswith the change:
Full suite:
41 -> 42tests,40 pass / 2 fail. The two failures(
extractAudio reuses cached files...,reference audio route extracts missing audio once...) are pre-existing — the unmodified base commit fails thesame two, and the change does not touch audio extraction.
Closes #57