aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-05-05 18:37:32 -0500
committerLibravatar GitHub <noreply@github.com>2022-05-05 23:37:32 +0000
commit875dedc70a08c2cc132536d18490d89bf34f7335 (patch)
tree75a17913d6140b3b6dfa473858c52ce32e8a8c44 /src
parentfix: modify user agent string on Linux (#99) (diff)
downloadferdium-app-875dedc70a08c2cc132536d18490d89bf34f7335.tar.gz
ferdium-app-875dedc70a08c2cc132536d18490d89bf34f7335.tar.zst
ferdium-app-875dedc70a08c2cc132536d18490d89bf34f7335.zip
Do not allow http urls that end in '/' (fixes #102) (#103)
Diffstat (limited to 'src')
-rw-r--r--src/helpers/url-helpers.ts3
-rw-r--r--src/helpers/validation-helpers.ts2
-rw-r--r--src/i18n/locales/en-US.json2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts
index ddbf4b4f7..ef2805595 100644
--- a/src/helpers/url-helpers.ts
+++ b/src/helpers/url-helpers.ts
@@ -15,6 +15,9 @@ export function isValidExternalURL(url: string | URL) {
15 } catch { 15 } catch {
16 return false; 16 return false;
17 } 17 }
18 if (url.toString().endsWith('/')) {
19 return false;
20 }
18 21
19 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol); 22 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol);
20 23
diff --git a/src/helpers/validation-helpers.ts b/src/helpers/validation-helpers.ts
index 4e0af8b08..c3c0f79bf 100644
--- a/src/helpers/validation-helpers.ts
+++ b/src/helpers/validation-helpers.ts
@@ -13,7 +13,7 @@ const messages = defineMessages({
13 }, 13 },
14 url: { 14 url: {
15 id: 'validation.url', 15 id: 'validation.url',
16 defaultMessage: '{field} is not a valid URL', 16 defaultMessage: "{field} is not a valid URL (cannot end in '/')",
17 }, 17 },
18 minLength: { 18 minLength: {
19 id: 'validation.minLength', 19 id: 'validation.minLength',
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 095c12762..22061fc9c 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -432,7 +432,7 @@
432 "validation.minLength": "{field} should be at least {length} characters long", 432 "validation.minLength": "{field} should be at least {length} characters long",
433 "validation.oneRequired": "At least one is required", 433 "validation.oneRequired": "At least one is required",
434 "validation.required": "{field} is required", 434 "validation.required": "{field} is required",
435 "validation.url": "{field} is not a valid URL", 435 "validation.url": "{field} is not a valid URL (cannot end in '/')",
436 "webControls.back": "Back", 436 "webControls.back": "Back",
437 "webControls.forward": "Forward", 437 "webControls.forward": "Forward",
438 "webControls.goHome": "Home", 438 "webControls.goHome": "Home",