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)" (#30770)

This partially reverts commit 9c2b9ac.
  • Loading branch information
XhmikosR committed May 13, 2020
1 parent 97eb2c1 commit b07b342
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/src/util/sanitizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const 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 @@ -47,7 +47,7 @@ const 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 b07b342

Please sign in to comment.