diff options
Diffstat (limited to 'src/helpers/validation-helpers.ts')
-rw-r--r-- | src/helpers/validation-helpers.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/helpers/validation-helpers.ts b/src/helpers/validation-helpers.ts index 3a9622309..23c297443 100644 --- a/src/helpers/validation-helpers.ts +++ b/src/helpers/validation-helpers.ts | |||
@@ -49,16 +49,15 @@ export function url({ field }) { | |||
49 | const value = field.value.trim(); | 49 | const value = field.value.trim(); |
50 | let isValid = false; | 50 | let isValid = false; |
51 | 51 | ||
52 | if (value !== '') { | 52 | isValid = |
53 | // eslint-disable-next-line | 53 | value !== '' |
54 | isValid = Boolean( | 54 | ? Boolean( |
55 | value.match( | 55 | // eslint-disable-next-line unicorn/better-regex |
56 | /(^|[\s.:;?\-\]<(])(https?:\/\/[-\w;/?:@&=+$|_.!~*|'()[\]%#,☺]+[\w/#](\(\))?)(?=$|[\s',|().:;?\-[\]>)])/i, | 56 | /(^|[\s.:;?\-\]<(])(https?:\/\/[-\w;/?:@&=+$|_.!~*|'()[\]%#,☺]+[\w/#](\(\))?)(?=$|[\s',|().:;?\-[\]>)])/i.test( |
57 | ), | 57 | value, |
58 | ); | 58 | ), |
59 | } else { | 59 | ) |
60 | isValid = true; | 60 | : true; |
61 | } | ||
62 | 61 | ||
63 | return [ | 62 | return [ |
64 | isValid, | 63 | isValid, |