1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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 <srichards@mirantis.com>
This commit is contained in:
Steve Richards 2020-10-07 16:58:24 +01:00
parent abe6a4e0b1
commit 31cab39497

View File

@ -39,7 +39,7 @@ export const isNumber: Validator = {
export const isUrl: Validator = { export const isUrl: Validator = {
condition: ({ type }) => type === "url", condition: ({ type }) => type === "url",
message: () => _i18n._(t`Wrong url format`), 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 = { export const isPath: Validator = {