From e8b11af2a2a014cf6c22cd6d62599fae8ec9e133 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Mon, 16 Aug 2021 12:42:23 +0530 Subject: fix: fix issue with left-clicking regression (was introduced due to the typescript conversion) --- src/helpers/url-helpers.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/helpers') diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts index 23e8fab29..e330fae40 100644 --- a/src/helpers/url-helpers.ts +++ b/src/helpers/url-helpers.ts @@ -8,10 +8,10 @@ import { ALLOWED_PROTOCOLS } from '../config'; const debug = require('debug')('Ferdi:Helpers:url'); -export function isValidExternalURL(url: string) { +export function isValidExternalURL(url: string | URL) { let parsedUrl: URL; try { - parsedUrl = new URL(url); + parsedUrl = new URL(url.toString()); } catch (_) { return false; } @@ -29,8 +29,9 @@ export async function openPath(folderName: string) { } // TODO: Need to verify and fix/remove the skipping logic. Ideally, we should never skip this check -export function openExternalUrl(url: string, skipValidityCheck: boolean = false) { +export function openExternalUrl(url: string | URL, skipValidityCheck: boolean = false) { + debug('for url:', url, 'skipValidityCheck:', skipValidityCheck); if (skipValidityCheck || isValidExternalURL(url)) { - shell.openExternal(url); + shell.openExternal(url.toString()); } } -- cgit v1.2.3-54-g00ecf