From 02882f91410427dc63c0b6acff5639539c28ef86 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:27:55 -0800 Subject: [PATCH] Fix issue in Verify-Link.ps1 after PS 7.4 update (#5314) https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-74?view=powershell-7.4 - Add AllowInsecureRedirect switch to Web cmdlets (#18546) That new option cause a new exception type that exposed a bug where we assumed if InnerException property existed that it was not null. This fix verifies that the property is not null. Co-authored-by: Wes Haggard --- eng/common/scripts/Verify-Links.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Verify-Links.ps1 b/eng/common/scripts/Verify-Links.ps1 index 62fd3df98..396ece4ac 100644 --- a/eng/common/scripts/Verify-Links.ps1 +++ b/eng/common/scripts/Verify-Links.ps1 @@ -260,7 +260,7 @@ function CheckLink ([System.Uri]$linkUri, $allowRetry=$true) $innerExceptionPresent = $_.Exception.psobject.Properties.name -contains "InnerException" $errorCodePresent = $false - if ($innerExceptionPresent) { + if ($innerExceptionPresent -and $_.Exception.InnerException) { $errorCodePresent = $_.Exception.InnerException.psobject.Properties.name -contains "ErrorCode" }