Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions XSD_Validation/powershell/Validate-FundsXml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ function Get-File($url, $dest) {
Invoke-WebRequest -Uri $url -OutFile $dest -MaximumRedirection 5 -UseBasicParsing
}

if ($env:FUNDSXML_SCHEMA_DIR) {
$schemaPath = Join-Path $env:FUNDSXML_SCHEMA_DIR 'FundsXML.xsd'
# cmd's `set VAR="x"` keeps the quotes in the value; a stray " is an
# illegal path char and crashes Test-Path. Trim quotes/whitespace so the
# escape hatch tolerates that common mistake.
$schemaDirEnv = if ($env:FUNDSXML_SCHEMA_DIR) {
$env:FUNDSXML_SCHEMA_DIR.Trim().Trim('"', "'")
} else { '' }

if ($schemaDirEnv) {
$schemaPath = Join-Path $schemaDirEnv 'FundsXML.xsd'
if (-not (Test-Path $schemaPath)) {
Write-Error "FUNDSXML_SCHEMA_DIR set but $schemaPath not found"; exit 2
}
Expand Down
Loading