Add -safebase64 directive in urlskip= · gorhill/uBlock@bcc058e (original) (raw)
`@@ -5417,6 +5417,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
`
5417
5417
` *
`
5418
5418
`` * -base64: decode the current string as a base64-encoded string.
``
5419
5419
` *
`
``
5420
`` +
-safebase64: decode the current string as a safe base64-encoded string.
``
``
5421
`+
*
`
5420
5422
`` * -uricomponent: decode the current string as a URI encoded string.
``
5421
5423
` *
`
5422
5424
`` * -blocked: allow the redirection of blocked requests. By default, blocked
``
`@@ -5498,6 +5500,12 @@ function urlSkip(directive, url, blocked, steps) {
`
5498
5500
`urlout = self.atob(urlin);
`
5499
5501
`continue;
`
5500
5502
`}
`
``
5503
`+
// Safe Base64
`
``
5504
`+
if ( step === '-safebase64' ) {
`
``
5505
`+
urlout = urlin.replace(/[-_]/, safeBase64Replacer);
`
``
5506
`+
urlout = self.atob(urlout);
`
``
5507
`+
continue;
`
``
5508
`+
}
`
5501
5509
`// URI component
`
5502
5510
`if ( step === '-uricomponent' ) {
`
5503
5511
`urlout = self.decodeURIComponent(urlin);
`
`@@ -5543,6 +5551,9 @@ function urlSkip(directive, url, blocked, steps) {
`
5543
5551
`}
`
5544
5552
`}
`
5545
5553
``
``
5554
`+
const safeBase64Map = { '-': '+', '_': '/' };
`
``
5555
`+
const safeBase64Replacer = s => safeBase64Map[s];
`
``
5556
+
5546
5557
`/******************************************************************************/
`
5547
5558
``
5548
5559
`// https://github.com/uBlockOrigin/uBlock-issues/issues/1626
`