File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,12 @@ export function getEscapeFunction() {
5151 * @returns {string } The escaped argument.
5252 */
5353function escapeArgForQuoted ( arg ) {
54- return escapeArg ( arg ) . replace ( / (?< ! \\ ) ( \\ * ) ( [ \t ] ) / gu, "$1$1$2" ) ;
54+ return arg
55+ . replace ( / [ \0 \u0008 \r \u001B \u009B ] / gu, "" )
56+ . replace ( / \n / gu, " " )
57+ . replace ( / (?< ! \\ ) ( \\ * ) " / gu, '$1$1\\"' )
58+ . replace ( / ( [ % & < > ^ | ] ) / gu, "^$1" )
59+ . replace ( / (?< ! \\ ) ( \\ * ) ( [ \t ] ) / gu, "$1$1$2" ) ;
5560}
5661
5762/**
Original file line number Diff line number Diff line change @@ -4572,7 +4572,7 @@ export const quote = {
45724572 "carets ('^') + double quotes ('\"')" : [
45734573 {
45744574 input : 'a"b^c' ,
4575- expected : 'a\\"b^c' ,
4575+ expected : 'a\\"b^^ c' ,
45764576 } ,
45774577 {
45784578 input : 'a"b"c^d' ,
@@ -4622,7 +4622,7 @@ export const quote = {
46224622 "percentage signs ('%') + double quotes ('\"')" : [
46234623 {
46244624 input : 'a"b%c' ,
4625- expected : 'a\\"b%c' ,
4625+ expected : 'a\\"b^ %c' ,
46264626 } ,
46274627 {
46284628 input : 'a"b"c%d' ,
@@ -4654,7 +4654,7 @@ export const quote = {
46544654 "ampersands ('&') + double quotes ('\"')" : [
46554655 {
46564656 input : 'a"b&c' ,
4657- expected : 'a\\"b&c' ,
4657+ expected : 'a\\"b^ &c' ,
46584658 } ,
46594659 {
46604660 input : 'a"b"c&d' ,
@@ -4722,7 +4722,7 @@ export const quote = {
47224722 "pipes ('|') + double quotes ('\"')" : [
47234723 {
47244724 input : 'a"b|c' ,
4725- expected : 'a\\"b|c' ,
4725+ expected : 'a\\"b^ |c' ,
47264726 } ,
47274727 {
47284728 input : 'a"b"c|d' ,
@@ -4774,11 +4774,11 @@ export const quote = {
47744774 "angle brackets ('<', '>') + double quotes ('\"')" : [
47754775 {
47764776 input : 'a"b>c' ,
4777- expected : 'a\\"b>c' ,
4777+ expected : 'a\\"b^ >c' ,
47784778 } ,
47794779 {
47804780 input : 'a"b<c' ,
4781- expected : 'a\\"b<c' ,
4781+ expected : 'a\\"b^ <c' ,
47824782 } ,
47834783 {
47844784 input : 'a"b"c>d' ,
You can’t perform that action at this time.
0 commit comments