From 4aaf452883defa23d8ea90a7ffbfa98bc91276d8 Mon Sep 17 00:00:00 2001 From: ShirokaiLon <6662937+ShirokaiLon@users.noreply.github.com> Date: Fri, 8 Feb 2019 13:01:08 +0000 Subject: [PATCH] Ignore regex URI when launching (#28) * Do not launch regex URI * Fix incorrect check * More null checks --- src/models/view/loginUriView.ts | 2 +- src/models/view/loginView.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/models/view/loginUriView.ts b/src/models/view/loginUriView.ts index 84e37176c1..74c5638e85 100644 --- a/src/models/view/loginUriView.ts +++ b/src/models/view/loginUriView.ts @@ -78,7 +78,7 @@ export class LoginUriView implements View { if (this._canLaunch != null) { return this._canLaunch; } - if (this.uri != null) { + if (this.uri != null && this.match != UriMatchType.RegularExpression) { const uri = this.launchUri; for (let i = 0; i < CanLaunchWhitelist.length; i++) { if (uri.indexOf(CanLaunchWhitelist[i]) === 0) { diff --git a/src/models/view/loginView.ts b/src/models/view/loginView.ts index 8f4173ea92..66f95bb368 100644 --- a/src/models/view/loginView.ts +++ b/src/models/view/loginView.ts @@ -31,11 +31,18 @@ export class LoginView implements View { } get canLaunch(): boolean { - return this.hasUris && this.uris[0].canLaunch; + return this.hasUris && this.uris.some(uri => uri.canLaunch); } get launchUri(): string { - return this.canLaunch ? this.uris[0].launchUri : null; + if (this.hasUris) { + const uri = this.uris.find(uri => uri.canLaunch) + if (uri != null) { + return uri.launchUri; + } + } + + return null; } get hasUris(): boolean {