summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-05-06 00:17:32 +0000
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-05-06 19:16:06 +0200
commited58b7905e42562063058b283a90672e19d33ea0 (patch)
treeeaf380b2c98094cc68bac773120263ee98030ada
parent31f47a2ba435d44ae7d8e0bfe70ac2d7c7993af9 (diff)
downloadUXP-ed58b7905e42562063058b283a90672e19d33ea0.tar
UXP-ed58b7905e42562063058b283a90672e19d33ea0.tar.gz
UXP-ed58b7905e42562063058b283a90672e19d33ea0.tar.lz
UXP-ed58b7905e42562063058b283a90672e19d33ea0.tar.xz
UXP-ed58b7905e42562063058b283a90672e19d33ea0.zip
[devtools] Port various upstream fixes
-rw-r--r--devtools/client/shared/curl.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/devtools/client/shared/curl.js b/devtools/client/shared/curl.js
index d9abf506a..5ce9e96bb 100644
--- a/devtools/client/shared/curl.js
+++ b/devtools/client/shared/curl.js
@@ -91,7 +91,7 @@ const Curl = {
if (utils.isUrlEncodedRequest(data) ||
["PUT", "POST", "PATCH"].includes(data.method)) {
postDataText = data.postDataText;
- addPostData("--data");
+ addPostData("--data-raw");
addPostData(utils.writePostDataTextParams(postDataText));
ignoredHeaders.add("content-length");
} else if (multipartRequest) {
@@ -400,7 +400,12 @@ const CurlUtils = {
* Credit: Google DevTools
*/
escapeStringWin: function (str) {
- /* Replace quote by double quote (but not by \") because it is
+ /*
+ Replace dollar sign because of commands (e.g $(cmd.exe)) in
+ powershell when using double quotes.
+ Useful details http://www.rlmueller.net/PowerShellEscape.htm
+
+ Replace quote by double quote (but not by \") because it is
recognized by both cmd.exe and MS Crt arguments parser.
Replace % by "%" because it could be expanded to an environment
@@ -414,7 +419,8 @@ const CurlUtils = {
Replace new line outside of quotes since cmd.exe doesn't let
to do it inside.
*/
- return "\"" + str.replace(/"/g, "\"\"")
+ return "\"" + str.replace(/\$/g, "`$")
+ .replace(/"/g, "\"\"")
.replace(/%/g, "\"%\"")
.replace(/\\/g, "\\\\")
.replace(/[\r\n]+/g, "\"^$&\"") + "\"";