Skip to content

Commit

Permalink
Fix issue in Verify-Link.ps1 after PS 7.4 update
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weshaggard authored and azure-sdk committed Feb 2, 2024
1 parent 9ae828c commit 96cab51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eng/common/scripts/Verify-Links.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down

0 comments on commit 96cab51

Please sign in to comment.