summaryrefslogtreecommitdiff
path: root/windows/win_unzip.ps1
diff options
context:
space:
mode:
authorAndrea Scarpino <me@andreascarpino.it>2016-03-20 12:29:26 +0100
committerAndrea Scarpino <me@andreascarpino.it>2016-03-20 12:29:26 +0100
commit7f386385752a9ba9154fd0ce3f40d6dcd7685687 (patch)
tree3d046b3183e7c69909bfa35ab918e55edaf4f07c /windows/win_unzip.ps1
parent10e70b5f4864531e64e7d201d27ced5ec4e4ef1b (diff)
downloadansible-modules-extras-7f386385752a9ba9154fd0ce3f40d6dcd7685687.tar.gz
win_unzip: Use absolute path for src and dest
win_unzip fails to extract files when either src or dest contains complex paths such as "..\..\" or "C:\\Program Files" (double slashes). Fix this by fetching absolute path of both before invoking CopyHere method.
Diffstat (limited to 'windows/win_unzip.ps1')
-rw-r--r--windows/win_unzip.ps14
1 files changed, 2 insertions, 2 deletions
diff --git a/windows/win_unzip.ps1 b/windows/win_unzip.ps1
index f547c008..59fbd331 100644
--- a/windows/win_unzip.ps1
+++ b/windows/win_unzip.ps1
@@ -59,8 +59,8 @@ $rm = ConvertTo-Bool (Get-AnsibleParam -obj $params -name "rm" -default "false")
If ($ext -eq ".zip" -And $recurse -eq $false) {
Try {
$shell = New-Object -ComObject Shell.Application
- $zipPkg = $shell.NameSpace($src)
- $destPath = $shell.NameSpace($dest)
+ $zipPkg = $shell.NameSpace([IO.Path]::GetFullPath($src))
+ $destPath = $shell.NameSpace([IO.Path]::GetFullPath($dest))
# 20 means do not display any dialog (4) and overwrite any file (16)
$destPath.CopyHere($zipPkg.Items(), 20)
$result.changed = $true