Skip to content

Commit

Permalink
Merge pull request #957 from brave/filter-out-headquote
Browse files Browse the repository at this point in the history
strip out adblock rules containing `head\"`
  • Loading branch information
antonok-edm authored Jul 31, 2024
2 parents bf89221 + 14bb1d4 commit 260f7ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/generateAdBlockRustDataFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ const enforceBraveDirectives = (title, data) => {
}

const removeIncompatibleRules = (listBuffer) => {
// Prior to adblock-rust 0.8.7, scriptlet arguments with trailing escaped commas can cause crashes.
listBuffer.data = listBuffer.data.split('\n').filter(line => {
line = line.trim()
// Prior to adblock-rust 0.8.7, scriptlet arguments with trailing escaped commas can cause crashes.
if (line.indexOf('+js(') >= 0 && line.endsWith('\\,)')) {
return false
}
// The rules from this commit don't include valid CSS; at the time of writing,
// Brave throws an error from the generic filter injection script if any CSS is invalid.
// https://github.com/uBlockOrigin/uAssets/commit/6eaa9dd46371478d76371426cb99f75d99c7402d
if (line.startsWith('##') >= 0 && line.indexOf('head\\"') >= 0) {
return false
}
return true
}).join('\n')
return listBuffer
Expand Down

0 comments on commit 260f7ba

Please sign in to comment.