Return nil from spam analyzers when primary headers are missing
Bug: https://github.com/happyDomain/happydeliver/issues/11
This commit is contained in:
parent
26025c96a2
commit
2fcee1b885
2 changed files with 15 additions and 0 deletions
|
|
@ -51,6 +51,13 @@ func (a *RspamdAnalyzer) AnalyzeRspamd(email *EmailMessage) *api.RspamdResult {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Require at least X-Spamd-Result or X-Rspamd-Score to produce a meaningful report
|
||||
_, hasSpamdResult := headers["X-Spamd-Result"]
|
||||
_, hasRspamdScore := headers["X-Rspamd-Score"]
|
||||
if !hasSpamdResult && !hasRspamdScore {
|
||||
return nil
|
||||
}
|
||||
|
||||
result := &api.RspamdResult{
|
||||
Symbols: make(map[string]api.RspamdSymbol),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue