Merge pull request #1834 from murgatroid99/grpc-js-xds_regex_match_case

grpc-js-xds: case_sensitive flag should not affect regex matcher
This commit is contained in:
Michael Lumish 2021-06-29 09:52:28 -07:00 committed by GitHub
commit f5eb9ccbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/grpc-js-xds", "name": "@grpc/grpc-js-xds",
"version": "1.3.0", "version": "1.3.1",
"description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.", "description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.",
"main": "build/src/index.js", "main": "build/src/index.js",
"scripts": { "scripts": {

View File

@ -197,8 +197,8 @@ export class PathExactValueMatcher {
export class PathSafeRegexValueMatcher { export class PathSafeRegexValueMatcher {
private targetRegexImpl: RE2; private targetRegexImpl: RE2;
constructor(targetRegex: string, caseInsensitive: boolean) { constructor(targetRegex: string) {
this.targetRegexImpl = new RE2(`^${targetRegex}$`, caseInsensitive ? 'iu' : 'u'); this.targetRegexImpl = new RE2(`^${targetRegex}$`, 'u');
} }
apply(value: string) { apply(value: string) {

View File

@ -169,7 +169,7 @@ function getPredicateForMatcher(routeMatch: RouteMatch__Output): Matcher {
pathMatcher = new PathExactValueMatcher(routeMatch.path!, caseInsensitive); pathMatcher = new PathExactValueMatcher(routeMatch.path!, caseInsensitive);
break; break;
case 'safe_regex': case 'safe_regex':
pathMatcher = new PathSafeRegexValueMatcher(routeMatch.safe_regex!.regex, caseInsensitive); pathMatcher = new PathSafeRegexValueMatcher(routeMatch.safe_regex!.regex);
break; break;
default: default:
pathMatcher = new RejectValueMatcher(); pathMatcher = new RejectValueMatcher();