Skip to content

Commit 0e77f83

Browse files
committed
Use indexOf(';') approach
1 parent 487278a commit 0e77f83

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/common/InputHandler.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,14 +2972,18 @@ export class InputHandler extends Disposable implements IInputHandler {
29722972
* feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.
29732973
*/
29742974
public setHyperlink(data: string): boolean {
2975-
const args = data.match(/^([^;]*);(.*)$/)?.slice(1) ?? [];
2976-
if (args.length < 2) {
2977-
return false;
2975+
// Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)
2976+
const idx = data.indexOf(';');
2977+
if (idx === -1) {
2978+
// malformed sequence, just return as handled
2979+
return true;
29782980
}
2979-
if (args[1]) {
2980-
return this._createHyperlink(args[0], args[1]);
2981+
const id = data.slice(0, idx).trim();
2982+
const uri = data.slice(idx + 1);
2983+
if (uri) {
2984+
return this._createHyperlink(id, uri);
29812985
}
2982-
if (args[0].trim()) {
2986+
if (id.trim()) {
29832987
return false;
29842988
}
29852989
return this._finishHyperlink();

0 commit comments

Comments
 (0)