File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -460,9 +460,10 @@ function getRawFilterListFromQuery(rawQuery: SearchQueryString) {
460460// with identical query strings, each running the full parser from scratch.
461461const buildSearchQueryJSONCache = new Map < string , SearchQueryJSON | undefined > ( ) ;
462462const BUILD_SEARCH_QUERY_JSON_CACHE_MAX_SIZE = 50 ;
463+ const BUILD_SEARCH_QUERY_JSON_CACHE_KEY_SEPARATOR = '\x00' ; // Null byte prevents collisions if query/rawQuery contain arbitrary strings
463464
464465function buildSearchQueryJSON ( query : SearchQueryString , rawQuery ?: SearchQueryString ) {
465- const cacheKey = rawQuery ? `${ query } ||| ${ rawQuery } ` : query ;
466+ const cacheKey = rawQuery ? `${ query } ${ BUILD_SEARCH_QUERY_JSON_CACHE_KEY_SEPARATOR } ${ rawQuery } ` : query ;
466467 if ( buildSearchQueryJSONCache . has ( cacheKey ) ) {
467468 return buildSearchQueryJSONCache . get ( cacheKey ) ;
468469 }
You can’t perform that action at this time.
0 commit comments