aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/url-helpers.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/helpers/url-helpers.js b/src/helpers/url-helpers.js
index 2f429a25c..972f9b79a 100644
--- a/src/helpers/url-helpers.js
+++ b/src/helpers/url-helpers.js
@@ -5,7 +5,12 @@ import { ALLOWED_PROTOCOLS } from '../config';
5const debug = require('debug')('Ferdi:Helpers:url'); 5const debug = require('debug')('Ferdi:Helpers:url');
6 6
7export function isValidExternalURL(url) { 7export function isValidExternalURL(url) {
8 const parsedUrl = new URL(url); 8 let parsedUrl;
9 try {
10 parsedUrl = new URL(url);
11 } catch (_) {
12 return false;
13 }
9 14
10 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol); 15 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol);
11 16