1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

win_file - fix glob like paths (#54003)

This commit is contained in:
Jordan Borean 2019-03-19 09:20:33 +10:00 committed by GitHub
parent f9b812a982
commit c053bc1fc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- win_file - Fix issues when using paths with glob like characters, e.g. ``[``, ``]``

View file

@ -17,7 +17,7 @@ $state = Get-AnsibleParam -obj $params -name "state" -type "str" -validateset "a
# used in template/copy when dest is the path to a dir and source is a file
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
if ((Test-Path -Path $path -PathType Container) -and ($null -ne $original_basename)) {
if ((Test-Path -LiteralPath $path -PathType Container) -and ($null -ne $original_basename)) {
$path = Join-Path -Path $path -ChildPath $original_basename
}
@ -82,7 +82,7 @@ function Remove-File($file, $checkmode) {
}
function Remove-Directory($directory, $checkmode) {
foreach ($file in Get-ChildItem $directory.FullName) {
foreach ($file in Get-ChildItem -LiteralPath $directory.FullName) {
Remove-File -file $file -checkmode $checkmode
}
Remove-Item -LiteralPath $directory.FullName -Force -Recurse -WhatIf:$checkmode