File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -1490,9 +1490,10 @@ export class AstFilterParser {
1490
1490
realBad = true ;
1491
1491
break ;
1492
1492
}
1493
- if ( this . interactive ) {
1494
- const value = this . getNetOptionValue ( NODE_TYPE_NET_OPTION_NAME_REPLACE ) ;
1495
- realBad = parseReplaceValue ( value ) === undefined ;
1493
+ const value = this . getNetOptionValue ( NODE_TYPE_NET_OPTION_NAME_REPLACE ) ;
1494
+ if ( parseReplaceValue ( value ) === undefined ) {
1495
+ this . astError = AST_ERROR_OPTION_BADVALUE ;
1496
+ realBad = true ;
1496
1497
}
1497
1498
break ;
1498
1499
}
@@ -1504,8 +1505,8 @@ export class AstFilterParser {
1504
1505
realBad = true ;
1505
1506
break ;
1506
1507
}
1507
- const path = this . getNetOptionValue ( NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM ) ;
1508
- if ( path . charCodeAt ( 0 ) !== 0x2F /* / */ ) {
1508
+ const value = this . getNetOptionValue ( NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM ) ;
1509
+ if ( parseReplaceValue ( value ) === undefined ) {
1509
1510
this . astError = AST_ERROR_OPTION_BADVALUE ;
1510
1511
realBad = true ;
1511
1512
}
@@ -3008,6 +3009,7 @@ export function parseReplaceValue(s) {
3008
3009
if ( parser . transform ) {
3009
3010
pattern = parser . normalizeArg ( pattern ) ;
3010
3011
}
3012
+ if ( pattern === '' ) { return ; }
3011
3013
pattern = pattern
3012
3014
. replace ( reEscapedDollarSign , '$1$$$' )
3013
3015
. replace ( reEscapedComma , '$1,' ) ;
Original file line number Diff line number Diff line change @@ -5275,9 +5275,21 @@ FilterContainer.prototype.transformRequest = function(fctxt) {
5275
5275
if ( directives === undefined ) { return ; }
5276
5276
const directive = directives [ directives . length - 1 ] ;
5277
5277
if ( ( directive . bits & ALLOW_REALM ) !== 0 ) { return directives ; }
5278
+ if ( directive . refs instanceof Object === false ) { return ; }
5279
+ const { refs } = directive ;
5280
+ if ( refs . $cache === null ) {
5281
+ refs . $cache = sfp . parseReplaceValue ( refs . value ) ;
5282
+ }
5283
+ const cache = refs . $cache ;
5284
+ if ( cache === undefined ) { return ; }
5278
5285
const redirectURL = new URL ( fctxt . url ) ;
5279
- if ( directive . value === redirectURL . pathname ) { return ; }
5280
- redirectURL . pathname = directive . value ;
5286
+ const before = redirectURL . pathname + redirectURL . search ;
5287
+ if ( cache . re . test ( before ) !== true ) { return ; }
5288
+ const after = before . replace ( cache . re , cache . replacement ) ;
5289
+ if ( after === before ) { return ; }
5290
+ const searchPos = after . includes ( '?' ) && after . indexOf ( '?' ) || after . length ;
5291
+ redirectURL . pathname = after . slice ( 0 , searchPos ) ;
5292
+ redirectURL . search = after . slice ( searchPos ) ;
5281
5293
fctxt . redirectURL = redirectURL . href ;
5282
5294
return directives ;
5283
5295
} ;
You can’t perform that action at this time.
TMZ Celebrity News – Breaking Stories, Videos & Gossip
Looking for the latest TMZ celebrity news ? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.
Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.
🎥 Watch TMZ Live
TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.
Exclusive TMZ interviews and court updates
Viral celebrity videos and candid photos
Trending gossip and entertainment news
0 commit comments