fix: match skip prefixes on a path boundary#83
Open
abhay-codes07 wants to merge 1 commit into
Open
Conversation
cloudflare, netlify and vercel tested skip prefixes with a bare startsWith, so with the default ["/admin", "/api/", "/_"] a real page like /administrator matched /admin and was silently excluded from negotiation, its markdown twin, and the Link header. Use the same boundary-aware check as the deno and fastly adapters: match the exact path or a prefix/ subpath (a prefix already ending in / still matches via startsWith).
|
@abhay-codes07 is attempting to deploy a commit to the Dodo Payments Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR fixes an over-broad skip-prefix match in the Cloudflare, Netlify, and Vercel adapters by making skip-prefix checks path-boundary-aware (matching deno/fastly behavior), preventing legitimate pages like /administrator from being skipped.
Changes:
- Updated
shouldSkipin Cloudflare/Netlify/Vercel to only match prefixes on an exact path orprefix/boundary (while preservingprefix/behavior for prefixes ending with/). - Added regression tests in each adapter ensuring
/administratoris negotiated to its markdown twin for bot UAs. - Added a patch changeset for the three affected packages.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vercel/src/middleware.ts | Updates shouldSkip to enforce path-boundary prefix matching. |
| packages/vercel/test/middleware.test.ts | Adds regression test ensuring /administrator is not skipped and serves markdown to bot UA. |
| packages/netlify/src/worker.ts | Updates shouldSkip to enforce path-boundary prefix matching. |
| packages/netlify/test/worker.test.ts | Adds regression test ensuring /administrator is not skipped and serves markdown to bot UA. |
| packages/cloudflare/src/worker.ts | Updates shouldSkip to enforce path-boundary prefix matching. |
| packages/cloudflare/test/worker.test.ts | Adds regression test ensuring /administrator is not skipped and serves markdown to bot UA. |
| .changeset/skip-prefix-boundary.md | Records a patch release note for the three adapters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
cloudflare, netlify and vercel matched skip prefixes with a bare
startsWith, so with the default["/admin", "/api/", "/_"]a real page like/administratormatched/adminand was silently excluded from negotiation, its markdown twin, and the Link header. This adopts the same boundary-aware check the deno and fastly adapters already use.Closes #82.
Changes
shouldSkip: a prefix matches only the exact path or aprefix/subpath (a prefix already ending in/, like/api/, still matches viastartsWith). Asset paths under/_remain covered by the extension list./administratorwith a bot UA and a/administrator.mdtwin is now negotiated to markdown instead of skipped.Behavior for
/admin,/admin/...,/api/..., and/_next/*.jsis unchanged.Type
AEO_SPEC_VERSION)Verification
bun run buildpassesbun run testpasses (cloudflare 24, netlify 28, vercel 29)bun run typecheckpassesdualmark verify(no examples touched)/spec/: ran sync-spec (no spec files touched)Changeset
cc @thepushkaraj @aagarwal1012. This just brings cloudflare/netlify/vercel in line with the deno/fastly
shouldSkip.