Repository navigation
fix: correctly check URL pathname with Cloudflare adapter - #8733
Conversation
🦋 Changeset detectedLatest commit: 84de0dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| const filename = stripped_pathname.substring(1); | ||
| if (filename) { | ||
| is_asset = manifest.assets.has(filename) || manifest.assets.has(filename + '/index.html'); | ||
| } |
There was a problem hiding this comment.
Could there theoretically be an asset named index.html? What was the reason for changing this?
There was a problem hiding this comment.
Could there theoretically be an asset named index.html?
If a dev decides to include one in /static I suppose. It helps if someone navigates to that route.
This check was already there previously, but I suppose it's good to have it since the worker has to handle all file routing.
What was the reason for changing this?
I thought it would be a small optimisation, although I'm unsure if it has an impact.
If the url is https://test.com/, then the resulting filename would be ''. This addition helps skip the manifest check for an empty string.
Co-authored-by: Rich Harris <hello@rich-harris.dev>
fixes #8708
fixes #8736
I noticed a discrepancy where trailing slashes would be removed before checking if the file exists in
manifest.prerendered.This caused the pages with trailing slashes to never be found in the manifest.
Hopefully this fixes the issue for prerendered trailing slash pages that go through the Cloudflare worker.
Pages that manage to fit in the 100 rule limit for
_routes.jsondo not go through the worker so they don't have this issue.EDIT: expanded the scope of the PR to fix the URI encoding issue mismatch as well. It used to check the encoded pathname against the decoded paths in the manifest.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.