Skip to content

Commit

Permalink
EZP-31539: Link Validation error in Richtext Editor (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
konradoboza authored Apr 10, 2020
1 parent 769d88a commit 1eeeca0
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -413,11 +412,7 @@
return;
}

if (protocolPattern.test(href)) {
return;
}

if (restrictedKeywords.some((keyword) => href.includes(keyword))) {
if (schemaPattern.test(href)) {
return;
}

Expand Down

0 comments on commit 1eeeca0

Please # to comment.