Skip to content

Commit

Permalink
When config starts with ILLEGAL chars then they are removed
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickGrub committed Dec 21, 2020
1 parent 34aeb07 commit c3f0ef0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Files/powerGate/Modules/SelectionLists.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ function Get-PowerGateConfigFromVault {
}

try{
$byteOrderMarkUtf8 = [System.Text.Encoding]::UTF8.GetString([System.Text.Encoding]::UTF8.GetPreamble())
if ($xmlString.StartsWith($byteOrderMarkUtf8)) {
$xmlString = $xmlString.Remove(0, $byteOrderMarkUtf8.Length);
}

$xmlObject = New-Object -TypeName System.Xml.XmlDocument
$xmlObject.LoadXml($xmlString)
return $xmlObject
} catch{
Log -message "Unable to parse XML-String to XML-Object!"
return $null
} catch {
throw "Unable to parse powerGateConfiguration from the Vault Options to a valid XML-Object! An administrator must import a new XML via the command 'powerGate->Save Configuration' in the Vault Client.`n $($_.Exception.Message)"
}
Log -End
}
Expand Down

0 comments on commit c3f0ef0

Please sign in to comment.