diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/helpers/url-helpers.ts (renamed from src/helpers/url-helpers.js) | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/helpers/url-helpers.js b/src/helpers/url-helpers.ts index b0dc9afbb..23e8fab29 100644 --- a/src/helpers/url-helpers.js +++ b/src/helpers/url-helpers.ts | |||
@@ -8,8 +8,8 @@ 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) { | 11 | export function isValidExternalURL(url: string) { |
12 | let parsedUrl; | 12 | let parsedUrl: URL; |
13 | try { | 13 | try { |
14 | parsedUrl = new URL(url); | 14 | parsedUrl = new URL(url); |
15 | } catch (_) { | 15 | } catch (_) { |
@@ -23,13 +23,13 @@ export function isValidExternalURL(url) { | |||
23 | return isAllowed; | 23 | return isAllowed; |
24 | } | 24 | } |
25 | 25 | ||
26 | export async function openPath(folderName) { | 26 | export async function openPath(folderName: string) { |
27 | ensureDirSync(folderName); | 27 | ensureDirSync(folderName); |
28 | shell.openPath(folderName); | 28 | shell.openPath(folderName); |
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, skipValidityCheck = false) { | 32 | export function openExternalUrl(url: string, skipValidityCheck: boolean = false) { |
33 | if (skipValidityCheck || isValidExternalURL(url)) { | 33 | if (skipValidityCheck || isValidExternalURL(url)) { |
34 | shell.openExternal(url); | 34 | shell.openExternal(url); |
35 | } | 35 | } |