aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-16 12:42:23 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-16 13:04:21 +0530
commite8b11af2a2a014cf6c22cd6d62599fae8ec9e133 (patch)
tree48737d4f6606065849aba34340d92eb7087f67ad /src/helpers
parent5.6.1-nightly.28 [skip ci] (diff)
downloadferdium-app-e8b11af2a2a014cf6c22cd6d62599fae8ec9e133.tar.gz
ferdium-app-e8b11af2a2a014cf6c22cd6d62599fae8ec9e133.tar.zst
ferdium-app-e8b11af2a2a014cf6c22cd6d62599fae8ec9e133.zip
fix: fix issue with left-clicking regression
(was introduced due to the typescript conversion)
Diffstat (limited to 'src/helpers')
-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}