Uh oh!
There was an error while loading. Please reload this page.
util: fix OSC 8 hyperlink stripping in stripVTControlCharacters - #64319
Conversation
| '[\\dA-PR-TZcf-nq-uy=><~]))', 'g', | ||
| '(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))' + | ||
| '|[\\u001B\\u009B][[\\]()#;?]*' + | ||
| '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?' + |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
e3d3cb8 to
9da6ef2Comparedushyant-hada-90
commented
Jul 8, 2026
Pushed updates addressing the feedback: Accepted the [;:] CSI parameter separator suggestion (@Archkon) and reworded the commit to follow commit message guidelines Verified the final regex against every added test case and confirmed it now matches upstream ansi-regex v6.2.0 exactly. |
Uh oh!
There was an error while loading. Please reload this page.
711b204 to
7a426b8Comparedushyant-hada-90
commented
Jul 24, 2026
Hi @Archkon, @avivkeller |
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jul 25, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #64319 +/- ##
========================================
Coverage 90.14% 90.14% ========================================
Files 741 744 +3 Lines 242076 242516 +440 Branches 45558 45691 +133 ========================================
+ Hits 218216 218613 +397 - Misses 15385 15409 +24 - Partials 8475 8494 +19
🚀 New features to boost your workflow:
|
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> Signed-off-by: dushyant <dushyanthada90@gmail.com>
Co-authored-by: Archkon <180910180+Archkon@users.noreply.github.com> Signed-off-by: dushyant <dushyanthada90@gmail.com>
Signed-off-by: dushyant <dushyanthada90@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: dushyant <dushyanthada90@gmail.com>
Remove the extra non-capturing group around CSI parameters and the final byte so the bundled pattern matches ansi-regex at 72bc570 exactly. Refs: https://github.com/chalk/ansi-regex/blob/72bc570aaf25fca25541b49c6a8564f3ec63e835/index.js Signed-off-by: dushyant <dushyanthada90@gmail.com>
The previous comment claimed truncated OSC sequences were left unmatched rather than partially stripped. The CSI alternative can still consume a short prefix, which is why the expected remainder is 'ttps://...'. Update the comment to describe that behavior. Signed-off-by: dushyant <dushyanthada90@gmail.com>
a40efe2 to
8bcabf1CompareI have updated the commit message to comply with the Node.js commit guidelines, since the previous message was failing CI. |
nodejs-github-bot
commented
Jul 29, 2026
dushyant-hada-90
commented
Aug 2, 2026
Friendly ping, |
This comment was marked as spam.
This comment was marked as spam.
dushyant-hada-90
commented
Aug 4, 2026
Hi @aduh95 , can you please have a look at this PR when you have a chance? If everything looks good, I'd appreciate your help getting it landed. Thank you! |
nodejs-github-bot
commented
Aug 22, 2026
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Aug 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Aug 24, 2026
Landed in 5b316e5 |
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> Signed-off-by: dushyant <dushyanthada90@gmail.com> PR-URL: #64319Fixes: #64313 Reviewed-By: Aviv Keller <me@aviv.sh>
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> Signed-off-by: dushyant <dushyanthada90@gmail.com> PR-URL: #64319Fixes: #64313 Reviewed-By: Aviv Keller <me@aviv.sh>
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> Signed-off-by: dushyant <dushyanthada90@gmail.com> PR-URL: #64319Fixes: #64313 Reviewed-By: Aviv Keller <me@aviv.sh>
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