diff options
author | 2021-08-16 12:42:23 +0530 | |
---|---|---|
committer | 2021-08-16 13:04:21 +0530 | |
commit | e8b11af2a2a014cf6c22cd6d62599fae8ec9e133 (patch) | |
tree | 48737d4f6606065849aba34340d92eb7087f67ad /src/helpers/url-helpers.ts | |
parent | 5.6.1-nightly.28 [skip ci] (diff) | |
download | ferdium-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/url-helpers.ts')
-rw-r--r-- | src/helpers/url-helpers.ts | 9 |
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 | ||
9 | const debug = require('debug')('Ferdi:Helpers:url'); | 9 | const debug = require('debug')('Ferdi:Helpers:url'); |
10 | 10 | ||
11 | export function isValidExternalURL(url: string) { | 11 | export 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 |
32 | export function openExternalUrl(url: string, skipValidityCheck: boolean = false) { | 32 | export 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 | } |