Skip to content

Commit

Permalink
Flip indexOf logic
Browse files Browse the repository at this point in the history
The argument of `indexOf` should be the value to be searched.
  • Loading branch information
noppanit committed Sep 17, 2016
1 parent d25d196 commit 3d34193
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sanitize/blockedURI.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function isSpecialCase(blockedURI) {
];

specialCases.forEach(function(specialCase) {
if (specialCase.indexOf(blockedURI.trim()) === 0) {
if (blockedURI.trim().indexOf(specialCase) === 0) {
result = true;
}
});
Expand Down
1 change: 1 addition & 0 deletions test/lib/sanitize/blockedURI.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ suite(__dirname.split('/').pop(), function() {
assert.equal(isSpecialCase(' chromenull:// '), true);
assert.equal(isSpecialCase('chromenull:// '), true);
assert.equal(isSpecialCase(' chromenull:// '), true);
assert.equal(isSpecialCase('safari-extension://com.evernote.safari.clipper-q79wdw8yh9'), true);
});
});
});
Expand Down

0 comments on commit 3d34193

Please sign in to comment.