File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -15,17 +15,15 @@ function escapeArgument(arg, doubleEscapeMetaChars) {
15
15
arg = `${ arg } ` ;
16
16
17
17
// Algorithm below is based on https://qntm.org/cmd
18
- // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input
19
- // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information
20
18
21
19
// Sequence of backslashes followed by a double quote:
22
20
// double up all the backslashes and escape the double quote
23
- arg = arg . replace ( / (? = \\ * ? ) " / g, '$1$1\\"' ) ;
21
+ arg = arg . replace ( / ( \\ * ) " / g, '$1$1\\"' ) ;
24
22
25
23
// Sequence of backslashes followed by the end of the string
26
24
// (which will become a double quote later):
27
25
// double up all the backslashes
28
- arg = arg . replace ( / (? = \\ * ? ) $ / , '$1$1' ) ;
26
+ arg = arg . replace ( / ( \\ * ) $ / , '$1$1' ) ;
29
27
30
28
// All other backslashes occur literally
31
29
You can’t perform that action at this time.
0 commit comments