mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Use System.Xml.XmlDocument.Load rather than Get-Content to avoid (#49206)
encoding errors when writing out XML removing executable bit refactor tests to handle sanity checking
This commit is contained in:
parent
9d62cbc2af
commit
5cb39d0d57
4 changed files with 62 additions and 8 deletions
|
@ -107,9 +107,10 @@ If (-Not (Test-Path -Path $dest -PathType Leaf)){
|
|||
Fail-Json $result "Specified path $dest does not exist or is not a file."
|
||||
}
|
||||
|
||||
[xml]$xmlorig = $null
|
||||
$xmlorig = New-Object -TypeName System.Xml.XmlDocument
|
||||
$xmlorig.XmlResolver = $null
|
||||
Try {
|
||||
[xml]$xmlorig = Get-Content -Path $dest
|
||||
$xmlorig.Load($dest)
|
||||
}
|
||||
Catch {
|
||||
Fail-Json $result "Failed to parse file at '$dest' as an XML document: $($_.Exception.Message)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue