Skip to content

Commit 3a1bc38

Browse files
Merge pull request KelvinTegelaar#1637 from PeterVive/exo-default-spamfilter-empty-arrays
Invoke-CIPPStandardSpamFilterPolicy: Handle empty arrays correctly
2 parents ad46b9d + 21ef223 commit 3a1bc38

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ function Invoke-CIPPStandardSpamFilterPolicy {
124124
($CurrentState.PhishZapEnabled -eq $true) -and
125125
($CurrentState.SpamZapEnabled -eq $true) -and
126126
($CurrentState.EnableLanguageBlockList -eq $Settings.EnableLanguageBlockList) -and
127-
(($null -eq $CurrentState.LanguageBlockList -and $null -eq $Settings.LanguageBlockList.value) -or ($null -ne $CurrentState.LanguageBlockList -and $null -ne $Settings.LanguageBlockList.value -and !(Compare-Object -ReferenceObject $CurrentState.LanguageBlockList -DifferenceObject $Settings.LanguageBlockList.value))) -and
127+
((($null -eq $CurrentState.LanguageBlockList -or $CurrentState.LanguageBlockList.Count -eq 0) -and ($null -eq $Settings.LanguageBlockList.value)) -or ($null -ne $CurrentState.LanguageBlockList -and $CurrentState.LanguageBlockList.Count -gt 0 -and $null -ne $Settings.LanguageBlockList.value -and !(Compare-Object -ReferenceObject $CurrentState.LanguageBlockList -DifferenceObject $Settings.LanguageBlockList.value))) -and
128128
($CurrentState.EnableRegionBlockList -eq $Settings.EnableRegionBlockList) -and
129-
(($null -eq $CurrentState.RegionBlockList -and $null -eq $Settings.RegionBlockList.value) -or ($null -ne $CurrentState.RegionBlockList -and $null -ne $Settings.RegionBlockList.value -and !(Compare-Object -ReferenceObject $CurrentState.RegionBlockList -DifferenceObject $Settings.RegionBlockList.value))) -and
130-
(($null -eq $CurrentState.AllowedSenderDomains -and $null -eq ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains)) -or ($null -ne $CurrentState.AllowedSenderDomains -and $null -ne ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains) -and !(Compare-Object -ReferenceObject $CurrentState.AllowedSenderDomains -DifferenceObject ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains))))
129+
((($null -eq $CurrentState.RegionBlockList -or $CurrentState.RegionBlockList.Count -eq 0) -and ($null -eq $Settings.RegionBlockList.value)) -or ($null -ne $CurrentState.RegionBlockList -and $CurrentState.RegionBlockList.Count -gt 0 -and $null -ne $Settings.RegionBlockList.value -and !(Compare-Object -ReferenceObject $CurrentState.RegionBlockList -DifferenceObject $Settings.RegionBlockList.value))) -and
130+
((($null -eq $CurrentState.AllowedSenderDomains -or $CurrentState.AllowedSenderDomains.Count -eq 0) -and ($null -eq ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains))) -or ($null -ne $CurrentState.AllowedSenderDomains -and $CurrentState.AllowedSenderDomains.Count -gt 0 -and $null -ne ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains) -and !(Compare-Object -ReferenceObject $CurrentState.AllowedSenderDomains -DifferenceObject ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains))))
131131
}
132132
catch {
133133
$StateIsCorrect = $false

0 commit comments

Comments
 (0)