Skip to content

Commit 4e25442

Browse files
committed
windows escaping
1 parent a1f6ca3 commit 4e25442

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,19 @@ private function createPowershellArgs(string $payloadFile): string
108108
{
109109
$headerString = "";
110110
foreach ($this->_eventHeaders as $key => $value) {
111-
$headerString .= sprintf("'%s'='%s';", $key, $value);
111+
$escapedKey = str_replace("'", "''", $key);
112+
$escapedValue = str_replace("'", "''", $value);
113+
$headerString .= sprintf('"%s"="%s";', $escapedKey, $escapedValue);
112114
}
113115

114116
$scheme = $this->_ssl ? "https://" : "http://";
115117
$args = " Invoke-WebRequest";
116118
$args.= " -Method POST";
117119
$args.= " -UseBasicParsing";
118-
$args.= " -InFile $payloadFile";
119-
$args.= " -H @{" . $headerString . "}";
120+
$args.= " -InFile '$payloadFile'";
121+
$args.= " -H '@{" . $headerString . "}'";
120122
$args.= " -Uri " . escapeshellarg($scheme . $this->_host . ":" . $this->_port . $this->_path . "/bulk");
121-
$args.= " ; Remove-Item $payloadFile";
123+
$args.= " ; Remove-Item '$payloadFile'";
122124

123125
return $args;
124126
}

0 commit comments

Comments
 (0)