Fix patching `{{args}}` when instances of `$` are present

Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/16715#issuecomment-1484232457
This commit is contained in:
Raymond Hill 2023-03-27 09:04:35 -04:00
parent c3a2c0fb9f
commit 75abf77e62
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 1 deletions

View File

@ -213,7 +213,10 @@ const patchScriptlet = function(content, args) {
for ( let i = 0; i < arglist.length; i++ ) {
content = content.replace(`{{${i+1}}}`, arglist[i]);
}
return content.replace('{{args}}', arglist.map(a => `'${a}'`).join(', '));
return content.replace(
'{{args}}',
arglist.map(a => `'${a}'`).join(', ').replace(/\$/g, '$$$')
);
};
const logOne = function(tabId, url, filter) {