From deb8ca326fb22bbc1aa5886183ec09bae96ce31e Mon Sep 17 00:00:00 2001 From: David Paulson Date: Thu, 21 Dec 2023 07:39:02 -0600 Subject: [PATCH] Fix bug with NULL authLocation on unknown site location --- .../Analyzer/Get-IISAuthenticationType.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 b/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 index db9ddf6785..b735855d17 100644 --- a/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 +++ b/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 @@ -187,6 +187,15 @@ function Get-IISAuthenticationType { } } else { Write-Verbose "authLocation was NULL, but shouldn't be a problem we just use the parent." + $index = $currentKey.LastIndexOf("/") + + if ($index -eq -1) { + $continue = $false + Write-Verbose "No parent location. Need to determine how to address." + $getIisAuthenticationType[$failedKey].Add($appKey) + } else { + $currentKey = $currentKey.Substring(0, $index) + } } } elseif ($currentKey -ne $appKey) { # If we are at a parent location we might not have all the locations in the config. So this could be okay. @@ -196,6 +205,7 @@ function Get-IISAuthenticationType { if ($index -eq -1) { Write-Verbose "Didn't have root parent in the config file, this is odd." $getIisAuthenticationType[$failedKey].Add($appKey) + $continue = $false } else { $currentKey = $currentKey.Substring(0, $index) }