File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Entrypoints/HTTP Functions/Tenant/Standards Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ function Invoke-ListStandardsCompare {
6565
6666 if ($FieldValue -is [System.Boolean ]) {
6767 $FieldValue = [bool ]$FieldValue
68- } elseif ($FieldValue -like ' *{* ' ) {
68+ } elseif (Test-Json - Json $FieldValue - ErrorAction SilentlyContinue ) {
6969 $FieldValue = ConvertFrom-Json - InputObject $FieldValue - ErrorAction SilentlyContinue
7070 } else {
7171 $FieldValue = [string ]$FieldValue
Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ function Test-CIPPStandardLicense {
5555 return $true
5656 } catch {
5757 if (! $SkipLog.IsPresent ) {
58- Write-LogMessage - API ' Standards' - tenant $TenantFilter - message " Error checking license capabilities for standard $StandardName `: $ ( $_.Exception.Message ) " - sev Error
59- Set-CIPPStandardsCompareField - FieldName " standards.$StandardName " - FieldValue " License Missing: Error checking license capabilities - $ ( $_.Exception.Message ) " - Tenant $TenantFilter
58+ # Sanitize exception message to prevent JSON parsing issues - remove characters that could interfere with JSON detection
59+ $SanitizedMessage = $_.Exception.Message -replace ' [{}\[\]]' , ' '
60+ Write-LogMessage - API ' Standards' - tenant $TenantFilter - message " Error checking license capabilities for standard $StandardName `: $SanitizedMessage " - sev Error
61+ Set-CIPPStandardsCompareField - FieldName " standards.$StandardName " - FieldValue " License Missing: Error checking license capabilities - $SanitizedMessage " - Tenant $TenantFilter
6062 }
6163 return $false
6264 }
You can’t perform that action at this time.
0 commit comments