File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import * as os from 'os';
55import * as path from 'path' ;
66import * as child_process from 'child_process' ;
77import * as colors from 'colors' ;
8+ import * as lodash from 'lodash' ;
89
910import inquirer = require( 'inquirer' ) ;
1011
@@ -210,7 +211,7 @@ export class ChangeAction extends BaseRushAction {
210211 normalizedFolder = normalizedFolder + '/' ;
211212 }
212213
213- const pathRegex : RegExp = new RegExp ( `^${ normalizedFolder } ` , 'i' ) ;
214+ const pathRegex : RegExp = new RegExp ( `^${ lodash . escapeRegExp ( normalizedFolder ) } ` , 'i' ) ;
214215 for ( const folder of changedFolders ) {
215216 if ( folder && folder . match ( pathRegex ) ) {
216217 return true ;
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export class GitEmailPolicy {
7373
7474 // If there is a policy, at least one of the RegExp's must match
7575 for ( const pattern of rushConfiguration . gitAllowedEmailRegExps ) {
76- const regex : RegExp = new RegExp ( '^' + pattern + '$' , 'i' ) ;
76+ const regex : RegExp = new RegExp ( `^ ${ pattern } $` , 'i' ) ;
7777 if ( userEmail . match ( regex ) ) {
7878 return ;
7979 }
Original file line number Diff line number Diff line change 33
44import * as child_process from 'child_process' ;
55import * as colors from 'colors' ;
6+ import * as lodash from 'lodash' ;
67import { Executable } from '@microsoft/node-core-library' ;
78
89const DEFAULT_BRANCH : string = 'master' ;
@@ -59,7 +60,7 @@ export class VersionControl {
5960 const output : string = child_process . execSync (
6061 `git diff ${ targetBranch } ... --name-only --no-renames --diff-filter=A`
6162 ) . toString ( ) ;
62- const regex : RegExp | undefined = pathPrefix ? new RegExp ( `^${ pathPrefix } ` , 'i' ) : undefined ;
63+ const regex : RegExp | undefined = pathPrefix ? new RegExp ( `^${ lodash . escapeRegExp ( pathPrefix ) } ` , 'i' ) : undefined ;
6364 return output . split ( '\n' ) . map ( ( line ) => {
6465 if ( line ) {
6566 const trimmedLine : string = line . trim ( ) ;
You can’t perform that action at this time.
0 commit comments