From db9af88d91ee2a9d0299bcfb97d51ad4677a5621 Mon Sep 17 00:00:00 2001 From: steve richards Date: Wed, 14 Oct 2020 12:34:04 +0100 Subject: [PATCH] Updated regex for isUrl to allow for an empty string (#1049) Updated regex for isUrl to allow for an empty string aswell as a correct URL. Signed-off-by: Steve Richards Co-authored-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 = {