From 39faf8750a2d815b43e67bd17a5ddf7a81b373ba Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Sat, 20 Feb 2021 08:42:57 +0100 Subject: [PATCH] fix(constants): domain regex accepting invalid domains Change the domain regex to match the whole string. Before, the regex would accept a string if it contained a valid domain at any point. --- lib/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/constants.js b/lib/constants.js index 98eed18b..0d14448b 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -80,7 +80,7 @@ export const POSTGRESQL_DATE_FORMATS = { year: 'YYYY-01-01', }; -export const DOMAIN_REGEX = /localhost(:\d{1,5})?|((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}/; +export const DOMAIN_REGEX = /^localhost(:\d{1,5})?|((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/; export const DESKTOP_SCREEN_WIDTH = 1920; export const LAPTOP_SCREEN_WIDTH = 1024;