|
|
@ -239,7 +239,7 @@ if ($return_content -or $dest) {
|
|
|
|
$resp_st.Close()
|
|
|
|
$resp_st.Close()
|
|
|
|
|
|
|
|
|
|
|
|
if ($return_content) {
|
|
|
|
if ($return_content) {
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin)
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin) > $null
|
|
|
|
$content_bytes = $memory_st.ToArray()
|
|
|
|
$content_bytes = $memory_st.ToArray()
|
|
|
|
$result.content = [System.Text.Encoding]::UTF8.GetString($content_bytes)
|
|
|
|
$result.content = [System.Text.Encoding]::UTF8.GetString($content_bytes)
|
|
|
|
if ($result.ContainsKey("content_type") -and $result.content_type -Match ($JSON_CANDIDATES -join '|')) {
|
|
|
|
if ($result.ContainsKey("content_type") -and $result.content_type -Match ($JSON_CANDIDATES -join '|')) {
|
|
|
@ -252,7 +252,7 @@ if ($return_content -or $dest) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($dest) {
|
|
|
|
if ($dest) {
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin)
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin) > $null
|
|
|
|
$changed = $true
|
|
|
|
$changed = $true
|
|
|
|
|
|
|
|
|
|
|
|
if (Test-AnsiblePath -Path $dest) {
|
|
|
|
if (Test-AnsiblePath -Path $dest) {
|
|
|
@ -268,7 +268,7 @@ if ($return_content -or $dest) {
|
|
|
|
|
|
|
|
|
|
|
|
$result.changed = $changed
|
|
|
|
$result.changed = $changed
|
|
|
|
if ($changed -and (-not $check_mode)) {
|
|
|
|
if ($changed -and (-not $check_mode)) {
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin)
|
|
|
|
$memory_st.Seek(0, [System.IO.SeekOrigin]::Begin) > $null
|
|
|
|
$file_stream = [System.IO.File]::Create($dest)
|
|
|
|
$file_stream = [System.IO.File]::Create($dest)
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
$memory_st.CopyTo($file_stream)
|
|
|
|
$memory_st.CopyTo($file_stream)
|
|
|
|