diff --git a/server/handlers/validators.ts b/server/handlers/validators.ts index 895402122..5334f3f99 100644 --- a/server/handlers/validators.ts +++ b/server/handlers/validators.ts @@ -51,7 +51,7 @@ export const createLink = [ .customSanitizer(addProtocol) .custom( value => - urlRegex({ exact: true, strict: false }).test(value) || + urlRegex({ exact: true, strict: false, parens: true }).test(value) || /^(?!https?)(\w+):\/\//.test(value) ) .withMessage("URL is not valid.") @@ -139,7 +139,7 @@ export const editLink = [ .customSanitizer(addProtocol) .custom( value => - urlRegex({ exact: true, strict: false }).test(value) || + urlRegex({ exact: true, strict: false, parens: true }).test(value) || /^(?!https?)(\w+):\/\//.test(value) ) .withMessage("URL is not valid.")