From 1eeeca0762d7210f6c9b45c8a6cefaf519d4a6d6 Mon Sep 17 00:00:00 2001 From: Konrad Oboza <34310128+konradoboza@users.noreply.github.com> Date: Fri, 10 Apr 2020 10:03:46 +0200 Subject: [PATCH] EZP-31539: Link Validation error in Richtext Editor (#1338) --- .../public/js/scripts/fieldType/base/base-rich-text.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/fieldType/base/base-rich-text.js b/src/bundle/Resources/public/js/scripts/fieldType/base/base-rich-text.js index dbe15db350..1784384262 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/base/base-rich-text.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/base/base-rich-text.js @@ -398,11 +398,10 @@ const links = container.querySelectorAll('a'); const anchorPrefix = '#'; const protocolPrefix = 'http://'; - const restrictedKeywords = ['ezcontent', 'ezlocation']; links.forEach((link) => { const href = link.getAttribute('href'); - const protocolPattern = /^https?:\/\//i; + const schemaPattern = /^[a-z0-9]+:\/?\/?/i; const protocolHref = protocolPrefix.concat(href); if (!href) { @@ -413,11 +412,7 @@ return; } - if (protocolPattern.test(href)) { - return; - } - - if (restrictedKeywords.some((keyword) => href.includes(keyword))) { + if (schemaPattern.test(href)) { return; }