Skip to content

Commit 684dfd2

Browse files
authored
Fix issue with parsing multiline blocks
1 parent 16ec087 commit 684dfd2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Src/PowerShell/github-calls.ps1

+9-4
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,21 @@ function GetRawFile {
351351
}
352352

353353
try {
354-
$result = $requestResult | Select-Object -Expand Content
354+
$result = $requestResult.Content
355+
$output = ""
355356
# remove any empty lines or tabs in the result to prevent issues with parsing yaml
356-
$result = $result | Where-Object { $_.Trim().Replace("`t", "") -ne "" }
357+
foreach ($line in $result.Split([Environment]::NewLine)) {
358+
$trimmedLine = $line.Trim().Replace("`t", "").Replace(" ", "")
359+
if ($trimmedLine.Length -gt 0) {
360+
$output += $line + [Environment]::NewLine
361+
}
362+
}
363+
return $output
357364
}
358365
catch {
359366
Write-Warning "Error converting file content from url [$($logUrl)]"
360367
Write-Warning "Error: [$_]"
361368
Write-Warning "Content: [$requestResult]"
362369
return ""
363370
}
364-
365-
return $result
366371
}

0 commit comments

Comments
 (0)