diff options
author | 2021-10-27 07:25:26 +0530 | |
---|---|---|
committer | 2021-10-27 07:25:26 +0530 | |
commit | 477bdd76a7405ff10a5cfabdec00ee9ae02f2698 (patch) | |
tree | bfa8cfb70e6852b9f535ccfd9b05712269a70dc1 /src/helpers/url-helpers.ts | |
parent | Bumped up ferdi beta version to '5.6.3-beta.2' (diff) | |
parent | 5.6.3-nightly.44 [skip ci] (diff) | |
download | ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.gz ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.zst ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.zip |
Merge branch 'nightly' into release
Diffstat (limited to 'src/helpers/url-helpers.ts')
-rw-r--r-- | src/helpers/url-helpers.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts index 135f06cbf..c1ca3ab25 100644 --- a/src/helpers/url-helpers.ts +++ b/src/helpers/url-helpers.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | // This is taken from: https://benjamin-altpeter.de/shell-openexternal-dangers/ | 1 | // This is taken from: https://benjamin-altpeter.de/shell-openexternal-dangers/ |
2 | 2 | ||
3 | import { URL } from 'url'; | 3 | import { URL } from 'url'; |
4 | import { ensureDirSync } from 'fs-extra'; | 4 | import { ensureDirSync, existsSync } from 'fs-extra'; |
5 | import { shell } from 'electron'; | 5 | import { shell } from 'electron'; |
6 | 6 | ||
7 | import { ALLOWED_PROTOCOLS } from '../config'; | 7 | import { ALLOWED_PROTOCOLS } from '../config'; |
@@ -23,6 +23,10 @@ export function isValidExternalURL(url: string | URL) { | |||
23 | return isAllowed; | 23 | return isAllowed; |
24 | } | 24 | } |
25 | 25 | ||
26 | export function isValidFileUrl(path: string) { | ||
27 | return path.startsWith('file') && existsSync(new URL(path)); | ||
28 | } | ||
29 | |||
26 | export async function openPath(folderName: string) { | 30 | export async function openPath(folderName: string) { |
27 | ensureDirSync(folderName); | 31 | ensureDirSync(folderName); |
28 | shell.openPath(folderName); | 32 | shell.openPath(folderName); |