fix: sanitize hyperlink OSC output (#29) (thanks @mafulafunk)

This commit is contained in:
Peter Steinberger
2026-01-11 11:11:21 +00:00
parent 837b09fcad
commit 0a4699711f
3 changed files with 11 additions and 1 deletions
+7
View File
@@ -111,4 +111,11 @@ describe('output', () => {
expect(result).toContain('Click here');
expect(result).toContain('\x1b]8;;https://x.com/test\x07');
});
it('hyperlink strips OSC control characters from url and text', () => {
const cfg = { plain: false, emoji: true, color: true, hyperlinks: true };
const result = hyperlink('https://x.com/\u001btest\u0007', 'Hi\u001b\u0007', cfg);
expect(result).not.toContain('\u001btest\u0007');
expect(result).not.toContain('Hi\u001b\u0007');
});
});