fix(routing): throw on unbalanced braces in route glob patterns#40614
Merged
pavelfeldman merged 2 commits intomainfrom May 4, 2026
Merged
fix(routing): throw on unbalanced braces in route glob patterns#40614pavelfeldman merged 2 commits intomainfrom
pavelfeldman merged 2 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/microsoft/playwright/sessions/1435e555-adc6-49bf-a11c-fae1213fe5ac Co-authored-by: pavelfeldman <883973+pavelfeldman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unbalanced brace in route glob to prevent navigation abort
fix(routing): throw on unbalanced braces in route glob patterns
May 4, 2026
pavelfeldman
approved these changes
May 4, 2026
yury-s
approved these changes
May 4, 2026
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.
Globs with unbalanced
{/}passed topage.route()produced an invalid regex insideglobToRegexPattern. TheSyntaxErrorwas raised lazily at request-match time, silently aborting matched requests and timing out navigations withERR_ABORTED.Changes
packages/isomorphic/urlMatch.ts—globToRegexPatternnow throws a descriptive error on unmatched{, unmatched}, and nested{instead of emitting an unterminated regex group.packages/playwright-core/src/client/network.ts—RouteHandlerandWebSocketRouteHandlerconstructors eagerly callresolveGlobToRegexPatternfor string globs, so invalid patterns surface at thepage.route()/page.routeWebSocket()(andBrowserContextequivalents) call site rather than at request-match time.tests/page/interception.spec.ts— coverage for the new validation and forpage.route()rejecting on an invalid glob.Escaped braces (
\\{,\\}) remain literal and unaffected.