mirror of https://github.com/gorhill/uBlock.git
Add `-uricomponent` to `urlskip=` option
To unescape URI-encoded characters. Related discussion: https://github.com/uBlockOrigin/uBlock-issues/issues/3206#issuecomment-2406479971
This commit is contained in:
parent
4d982d9972
commit
01eebffc1f
|
@ -5406,6 +5406,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
|
||||||
*
|
*
|
||||||
* `-base64`: decode the current string as a base64-encoded string.
|
* `-base64`: decode the current string as a base64-encoded string.
|
||||||
*
|
*
|
||||||
|
* `-uricomponent`: decode the current string as a URI component string.
|
||||||
|
*
|
||||||
* At any given step, the currently extracted string may not necessarily be
|
* At any given step, the currently extracted string may not necessarily be
|
||||||
* a valid URL, and more transformation steps may be needed to obtain a valid
|
* a valid URL, and more transformation steps may be needed to obtain a valid
|
||||||
* URL once all the steps are applied.
|
* URL once all the steps are applied.
|
||||||
|
@ -5470,11 +5472,19 @@ function urlSkip(directive, urlin, steps) {
|
||||||
urlout = `https://${s}`;
|
urlout = `https://${s}`;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Decode base64
|
// Decode
|
||||||
if ( c0 === 0x2D && step === '-base64' ) {
|
if ( c0 === 0x2D ) {
|
||||||
|
// Base64
|
||||||
|
if ( step === '-base64' ) {
|
||||||
urlout = self.atob(urlin);
|
urlout = self.atob(urlin);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// URI component
|
||||||
|
if ( step === '-uricomponent' ) {
|
||||||
|
urlout = self.decodeURIComponent(urlin);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Regex extraction from first capture group
|
// Regex extraction from first capture group
|
||||||
if ( c0 === 0x2F ) { // /
|
if ( c0 === 0x2F ) { // /
|
||||||
if ( directive.cache === null ) {
|
if ( directive.cache === null ) {
|
||||||
|
|
Loading…
Reference in New Issue