Skip to content

fix: match skip prefixes on a path boundary#83

Open
abhay-codes07 wants to merge 1 commit into
dodopayments:mainfrom
abhay-codes07:fix/skip-prefix-boundary
Open

fix: match skip prefixes on a path boundary#83
abhay-codes07 wants to merge 1 commit into
dodopayments:mainfrom
abhay-codes07:fix/skip-prefix-boundary

Conversation

@abhay-codes07

Copy link
Copy Markdown

Summary

cloudflare, netlify and vercel matched 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. This adopts the same boundary-aware check the deno and fastly adapters already use.

Closes #82.

Changes

  • cloudflare, netlify, vercel shouldSkip: a prefix matches only the exact path or a prefix/ subpath (a prefix already ending in /, like /api/, still matches via startsWith). Asset paths under /_ remain covered by the extension list.
  • Added a regression test in each: /administrator with a bot UA and a /administrator.md twin is now negotiated to markdown instead of skipped.

Behavior for /admin, /admin/..., /api/..., and /_next/*.js is unchanged.

Type

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • Spec change (requires bump in AEO_SPEC_VERSION)
  • Docs / examples / tooling only

Verification

  • bun run build passes
  • bun run test passes (cloudflare 24, netlify 28, vercel 29)
  • bun run typecheck passes
  • If touching examples: ran dualmark verify (no examples touched)
  • If touching /spec/: ran sync-spec (no spec files touched)

Changeset

  • Added a changeset (patch for the three adapters)

cc @thepushkaraj @aagarwal1012. This just brings cloudflare/netlify/vercel in line with the deno/fastly shouldSkip.

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).
Copilot AI review requested due to automatic review settings July 1, 2026 02:56
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 shouldSkip in Cloudflare/Netlify/Vercel to only match prefixes on an exact path or prefix/ boundary (while preserving prefix/ behavior for prefixes ending with /).
  • Added regression tests in each adapter ensuring /administrator is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip prefixes over-match: /admin also skips /administrator (cloudflare, netlify, vercel)

2 participants