mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00: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:
committed by
jhawkesworth
parent
9d62cbc2af
commit
5cb39d0d57
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user