mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-24 19:33:01 +01:00
Add -safebase64
directive in urlskip=
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3206#issuecomment-2487392846
This commit is contained in:
parent
3aac2a7c97
commit
bcc058eba7
@ -5417,6 +5417,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
|
||||
*
|
||||
* `-base64`: decode the current string as a base64-encoded string.
|
||||
*
|
||||
* `-safebase64`: decode the current string as a safe base64-encoded string.
|
||||
*
|
||||
* `-uricomponent`: decode the current string as a URI encoded string.
|
||||
*
|
||||
* `-blocked`: allow the redirection of blocked requests. By default, blocked
|
||||
@ -5498,6 +5500,12 @@ function urlSkip(directive, url, blocked, steps) {
|
||||
urlout = self.atob(urlin);
|
||||
continue;
|
||||
}
|
||||
// Safe Base64
|
||||
if ( step === '-safebase64' ) {
|
||||
urlout = urlin.replace(/[-_]/, safeBase64Replacer);
|
||||
urlout = self.atob(urlout);
|
||||
continue;
|
||||
}
|
||||
// URI component
|
||||
if ( step === '-uricomponent' ) {
|
||||
urlout = self.decodeURIComponent(urlin);
|
||||
@ -5543,6 +5551,9 @@ function urlSkip(directive, url, blocked, steps) {
|
||||
}
|
||||
}
|
||||
|
||||
const safeBase64Map = { '-': '+', '_': '/' };
|
||||
const safeBase64Replacer = s => safeBase64Map[s];
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1626
|
||||
|
Loading…
Reference in New Issue
Block a user