mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #368] [MERGED] fix: enforce segment boundary in catch-all pattern matching #516
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#516
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/368
Author: @NathanDrake2406
Created: 3/9/2026
Status: ✅ Merged
Merged: 3/9/2026
Merged by: @james-elicx
Base:
main← Head:fix/catch-all-prefix-overmatch📝 Commits (2)
e1fc9f0fix: enforce segment boundary in catch-all pattern matchingcc7f1fatest: regression tests for catch-all prefix segment boundary overmatch📊 Changes
3 files changed (+46 additions, -4 deletions)
View changed files
📝
packages/vinext/src/config/config-matchers.ts(+5 -2)📝
packages/vinext/src/index.ts(+5 -2)📝
tests/shims.test.ts(+36 -0)📄 Description
Summary
matchConfigPattern('/foobar', '/foo/:path*')incorrectly returned{ path: 'bar' }because thestartsWith('/foo')check doesn't enforce a/segment boundary after the prefix/foobarthat share a prefix but aren't actual sub-pathsconfig-matchers.tsand the duplicated copy inindex.tsTest plan
matchConfigPattern('/foobar', '/foo/:path*')→nullmatchConfigPattern('/foo/bar', '/foo/:path*')→{ path: 'bar' }matchConfigPattern('/foo', '/foo/:path*')→{ path: '' }matchConfigPattern('/foobar', '/foo/:path+')→null🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.