diff options
author | 2023-05-25 13:04:39 +0530 | |
---|---|---|
committer | 2023-05-25 13:04:39 +0530 | |
commit | 44c5193ab8b25422ae5cb679ce788a8c636108ac (patch) | |
tree | dc29c85d019bb5f807d7f2041eaf3ebba3215431 /src/helpers/url-helpers.ts | |
parent | Bump eslint-plugin-unicorn from 42.0.0 to 46.0.0 (diff) | |
download | ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.gz ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.zst ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.zip |
Minor refactoring to remove code duplication
Diffstat (limited to 'src/helpers/url-helpers.ts')
-rw-r--r-- | src/helpers/url-helpers.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts index 9c5cf7752..795d3f2cb 100644 --- a/src/helpers/url-helpers.ts +++ b/src/helpers/url-helpers.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | import { URL } from 'url'; | 2 | import { URL } from 'url'; |
3 | import { ensureDirSync, existsSync } from 'fs-extra'; | 3 | import { ensureDirSync, existsSync } from 'fs-extra'; |
4 | import { shell } from 'electron'; | 4 | import { shell } from 'electron'; |
5 | import normalizeUrl from 'normalize-url'; | ||
5 | import { ALLOWED_PROTOCOLS } from '../config'; | 6 | import { ALLOWED_PROTOCOLS } from '../config'; |
6 | 7 | ||
7 | const debug = require('../preload-safe-debug')('Ferdium:Helpers:url'); | 8 | const debug = require('../preload-safe-debug')('Ferdium:Helpers:url'); |
@@ -49,3 +50,11 @@ export function openExternalUrl( | |||
49 | shell.openExternal(fixedUrl.toString()); | 50 | shell.openExternal(fixedUrl.toString()); |
50 | } | 51 | } |
51 | } | 52 | } |
53 | |||
54 | export function normalizedUrl(url: string) { | ||
55 | return normalizeUrl(url, { | ||
56 | stripAuthentication: false, | ||
57 | stripWWW: false, | ||
58 | removeTrailingSlash: false, | ||
59 | }); | ||
60 | } | ||