Skip to content

Commit 01eebff

Browse files
committed
Add -uricomponent to urlskip= option
To unescape URI-encoded characters. Related discussion: uBlockOrigin/uBlock-issues#3206 (comment)
1 parent 4d982d9 commit 01eebff

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/js/static-net-filtering.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -5406,6 +5406,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
54065406
*
54075407
* `-base64`: decode the current string as a base64-encoded string.
54085408
*
5409+
* `-uricomponent`: decode the current string as a URI component string.
5410+
*
54095411
* At any given step, the currently extracted string may not necessarily be
54105412
* a valid URL, and more transformation steps may be needed to obtain a valid
54115413
* URL once all the steps are applied.
@@ -5470,10 +5472,18 @@ function urlSkip(directive, urlin, steps) {
54705472
urlout = `https://${s}`;
54715473
continue;
54725474
}
5473-
// Decode base64
5474-
if ( c0 === 0x2D && step === '-base64' ) {
5475-
urlout = self.atob(urlin);
5476-
continue;
5475+
// Decode
5476+
if ( c0 === 0x2D ) {
5477+
// Base64
5478+
if ( step === '-base64' ) {
5479+
urlout = self.atob(urlin);
5480+
continue;
5481+
}
5482+
// URI component
5483+
if ( step === '-uricomponent' ) {
5484+
urlout = self.decodeURIComponent(urlin);
5485+
continue;
5486+
}
54775487
}
54785488
// Regex extraction from first capture group
54795489
if ( c0 === 0x2F ) { // /

0 commit comments

Comments
 (0)