aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/helpers/url-helpers.ts9
1 files changed, 5 insertions, 4 deletions
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';
8 8
9const debug = require('debug')('Ferdi:Helpers:url'); 9const debug = require('debug')('Ferdi:Helpers:url');
10 10
11export function isValidExternalURL(url: string) { 11export function isValidExternalURL(url: string | URL) {
12 let parsedUrl: URL; 12 let parsedUrl: URL;
13 try { 13 try {
14 parsedUrl = new URL(url); 14 parsedUrl = new URL(url.toString());
15 } catch (_) { 15 } catch (_) {
16 return false; 16 return false;
17 } 17 }
@@ -29,8 +29,9 @@ export async function openPath(folderName: string) {
29} 29}
30 30
31// TODO: Need to verify and fix/remove the skipping logic. Ideally, we should never skip this check 31// TODO: Need to verify and fix/remove the skipping logic. Ideally, we should never skip this check
32export function openExternalUrl(url: string, skipValidityCheck: boolean = false) { 32export function openExternalUrl(url: string | URL, skipValidityCheck: boolean = false) {
33 debug('for url:', url, 'skipValidityCheck:', skipValidityCheck);
33 if (skipValidityCheck || isValidExternalURL(url)) { 34 if (skipValidityCheck || isValidExternalURL(url)) {
34 shell.openExternal(url); 35 shell.openExternal(url.toString());
35 } 36 }
36} 37}