Skip to content

Commit

Permalink
Partially revert "Use regex.test() when we want to check for a Boolea…
Browse files Browse the repository at this point in the history
…n. (#29969)"

This partially reverts commit 6c46493.
  • Loading branch information
XhmikosR committed May 10, 2020
1 parent a5c169b commit 8846e72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/src/tools/sanitizer.js
Expand Up @@ -71,7 +71,7 @@ function allowedAttribute(attr, allowedAttributeList) {

if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.indexOf(attrName) !== -1) {
return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}

return true
Expand All @@ -81,7 +81,7 @@ function allowedAttribute(attr, allowedAttributeList) {

// Check if a regular expression validates the attribute.
for (let i = 0, len = regExp.length; i < len; i++) {
if (regExp[i].test(attrName)) {
if (attrName.match(regExp[i])) {
return true
}
}
Expand Down

0 comments on commit 8846e72

Please sign in to comment.