From 31cab394975e10f70df96f7fba9350ad24915bbc Mon Sep 17 00:00:00 2001 From: Steve Richards Date: Wed, 7 Oct 2020 16:58:24 +0100 Subject: [PATCH] Issue-992: Updated regex for isUrl to allow for an empty string Updated regex for isUrl to allow for an empty string aswell as a correct URL. Signed-off-by: Steve Richards --- src/renderer/components/input/input_validators.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/input/input_validators.ts b/src/renderer/components/input/input_validators.ts index 611394134f..b11dbfa1da 100644 --- a/src/renderer/components/input/input_validators.ts +++ b/src/renderer/components/input/input_validators.ts @@ -39,7 +39,7 @@ export const isNumber: Validator = { export const isUrl: Validator = { condition: ({ type }) => type === "url", message: () => _i18n._(t`Wrong url format`), - validate: value => !!value.match(/^http(s)?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)*$/), + validate: value => !!value.match(/^$|^http(s)?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)*$/), }; export const isPath: Validator = {