mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
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 <srichards@mirantis.com> Co-authored-by: Steve Richards <srichards@mirantis.com>
This commit is contained in:
parent
38796e582b
commit
db9af88d91
@ -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 = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user