From 5946c428f3f58116da60dd078106e04bf74ecb65 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 16 Aug 2024 18:33:07 +0300 Subject: [PATCH] remove advanced validation from the URL control --- controls/url/script.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/controls/url/script.js b/controls/url/script.js index 96f43256..ad723c76 100644 --- a/controls/url/script.js +++ b/controls/url/script.js @@ -49,6 +49,7 @@ addFilter('lzb.editor.control.url.render', 'lzb.editor', (render, props) => ( /** * Required check. + * Just check for empty value. Previously we used advanced URL validation, but we can't restrict values like '#' or 'relative-url-string'. * * @param {Object} validationData * @param {number} value @@ -60,17 +61,6 @@ function validate(validationData, value) { return { valid: false }; } - if ( - !/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( - value - ) - ) { - return { - valid: false, - message: 'Please enter a valid URL.', - }; - } - return validationData; } addFilter('lzb.editor.control.url.validate', 'lzb.editor', validate);