Skip to content

Commit 89bed30

Browse files
committed
Use JSON.parse to strip extra quotes
1 parent c0ce5ca commit 89bed30

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/content/commands.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ const Commands = Module("commands", {
892892
if ((res = str.match(/^()((?:[^\\\s"']|\\.)+)((?:\\$)?)/)))
893893
arg += res[2].replace(/\\(.)/g, "$1");
894894
else if ((res = str.match(/^(")((?:[^\\"]|\\.)*)("?)/)))
895-
arg += eval(res[0] + (res[3] ? "" : '"'));
895+
arg += JSON.parse(res[0] + (res[3] ? "" : '"'));
896896
else if ((res = str.match(/^(')((?:[^\\']|\\.)*)('?)/)))
897897
arg += res[2].replace(/\\(.)/g, function (n0, n1) /[\\']/.test(n1) ? n1 : n0);
898898
break;
@@ -901,7 +901,7 @@ const Commands = Module("commands", {
901901
if ((res = str.match(/^()((?:[^\\\s"']|\\.)+)((?:\\$)?)/)))
902902
arg += res[2].replace(/\\(.)/g, "$1");
903903
else if ((res = str.match(/^(")((?:[^\\"]|\\.)*)("?)/)))
904-
arg += eval(res[0] + (res[3] ? "" : '"'));
904+
arg += JSON.parse(res[0] + (res[3] ? "" : '"'));
905905
else if ((res = str.match(/^(')((?:[^']|'')*)('?)/)))
906906
arg += res[2].replace("''", "'", "g");
907907
break;
@@ -912,7 +912,7 @@ const Commands = Module("commands", {
912912
else if ((res = str.match(/^(""")((?:.?.?[^"])*)((?:""")?)/)))
913913
arg += res[2];
914914
else if ((res = str.match(/^(")((?:[^\\"]|\\.)*)("?)/)))
915-
arg += eval(res[0] + (res[3] ? "" : '"'));
915+
arg += JSON.parse(res[0] + (res[3] ? "" : '"'));
916916
else if ((res = str.match(/^(')((?:[^\\']|\\.)*)('?)/)))
917917
arg += res[2].replace(/\\(.)/g, function (n0, n1) /[\\']/.test(n1) ? n1 : n0);
918918
break;

0 commit comments

Comments
 (0)