mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
windows - Fix module utils with glob paths (#53835)
* windows - Fix module utils with glob paths * fix link util tests when using DOS 8.3 paths
This commit is contained in:
parent
a6a4e82984
commit
980ca564ce
7 changed files with 45 additions and 26 deletions
|
@ -321,7 +321,7 @@ Function Get-FileChecksum($path, $algorithm = 'sha1')
|
|||
Helper function to calculate a hash of a file in a way which PowerShell 3
|
||||
and above can handle
|
||||
#>
|
||||
If (Test-Path -Path $path -PathType Leaf)
|
||||
If (Test-Path -LiteralPath $path -PathType Leaf)
|
||||
{
|
||||
switch ($algorithm)
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ Function Get-FileChecksum($path, $algorithm = 'sha1')
|
|||
}
|
||||
|
||||
If ($PSVersionTable.PSVersion.Major -ge 4) {
|
||||
$raw_hash = Get-FileHash $path -Algorithm $algorithm
|
||||
$raw_hash = Get-FileHash -LiteralPath $path -Algorithm $algorithm
|
||||
$hash = $raw_hash.Hash.ToLower()
|
||||
} Else {
|
||||
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
|
||||
|
@ -342,7 +342,7 @@ Function Get-FileChecksum($path, $algorithm = 'sha1')
|
|||
$fp.Dispose();
|
||||
}
|
||||
}
|
||||
ElseIf (Test-Path -Path $path -PathType Container)
|
||||
ElseIf (Test-Path -LiteralPath $path -PathType Container)
|
||||
{
|
||||
$hash = "3";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue