util: fix OSC 8 hyperlink stripping in stripVTControlCharacters#64319
Open
dushyant-hada-90 wants to merge 1 commit into
Open
util: fix OSC 8 hyperlink stripping in stripVTControlCharacters#64319dushyant-hada-90 wants to merge 1 commit into
dushyant-hada-90 wants to merge 1 commit into
Conversation
The bundled ansi-regex OSC pattern used a restrictive URI character class that failed when URIs contained RFC 3986-valid characters such as parentheses. Match OSC sequences generically as ESC ] ... ST, aligned with ansi-regex v6.2.0. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fixes: #64313
Summary
The bundled
ansi-regexOSC pattern used bystripVTControlCharacters()relied on a restrictive URI character class that failed when OSC 8 hyperlink URIs contained RFC 3986-valid characters such as(,),!,+,[and].This updates OSC handling to match sequences generically as:
aligned with
ansi-regexv6.2.0.Problem
stripVTControlCharacters()failed to correctly strip OSC 8 hyperlinks whose URI contained characters omitted from the previous regex character class:Example:
Actual
Expected
The OSC match terminated early at
(, leaving most of the escape sequence in the output.Changes
BEL,ESC \, or0x9C)ansi-regexv6.2.0Tests
Added regression coverage in:
for OSC 8 hyperlinks containing:
()!+[ ]across all supported OSC string terminators.
Notes