fixed #10482 - duplicate browser tab opening when clicking a link with an IP in it

This commit is contained in:
Eugene 2025-05-24 15:19:43 +02:00
parent 406e9e1c42
commit e0c34ef7bc
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 9 additions and 1 deletions

View File

@ -13,4 +13,12 @@ export abstract class LinkHandler {
}
abstract handle (uri: string, tab?: BaseTerminalTabComponent<any>): void
private _fullMatchRegex: RegExp | null = null
get fullMatchRegex (): RegExp {
if (!this._fullMatchRegex) {
this._fullMatchRegex = new RegExp(`^${this.regex.source}$`)
}
return this._fullMatchRegex
}
}

View File

@ -31,7 +31,7 @@ export class LinkHighlighterDecorator extends TerminalDecorator {
const openLink = async uri => {
for (const handler of this.handlers) {
if (!handler.regex.test(uri)) {
if (!handler.fullMatchRegex.test(uri)) {
continue
}
if (!await handler.verify(await handler.convert(uri, tab), tab)) {