diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-17 12:07:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-17 12:07:38 +0100 |
commit | 6045b2873a1c212aa51b0250b1f5193a28d853f5 (patch) | |
tree | b2d93e8811ec5075f0a000e867c409acab57aee3 | |
parent | 0aee4274fc8853bdb6f7d666e2853f97431dbf81 (diff) | |
download | rspamd-6045b2873a1c212aa51b0250b1f5193a28d853f5.tar.gz rspamd-6045b2873a1c212aa51b0250b1f5193a28d853f5.zip |
[Minor] Simplify condition and add them merely when mime utf is enabled
-rw-r--r-- | rules/regexp/headers.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index c796f0c81..daa1e378d 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -31,9 +31,6 @@ reconf['SUBJECT_NEEDS_ENCODING'] = { score = 1.0, mime_only = true, description = 'Subject needs encoding', - condition = function() - return not rspamd_config:is_mime_utf() - end, group = 'headers' } @@ -45,9 +42,6 @@ reconf['FROM_NEEDS_ENCODING'] = { score = 1.0, mime_only = true, description = 'From header needs encoding', - condition = function() - return not rspamd_config:is_mime_utf() - end, group = 'headers' } @@ -59,12 +53,22 @@ reconf['TO_NEEDS_ENCODING'] = { score = 1.0, mime_only = true, description = 'To header needs encoding', - condition = function() - return not rspamd_config:is_mime_utf() - end, group = 'headers', } +if rspamd_config:is_mime_utf() then + -- Disable some of the rules preserving the underlying logic + reconf['FROM_NEEDS_ENCODING'].condition = function() + return false + end + reconf['TO_NEEDS_ENCODING'].condition = function() + return false + end + reconf['SUBJECT_NEEDS_ENCODING'].condition = function() + return false + end +end + -- Detects that there is no space in From header (e.g. Some Name<some@host>) reconf['R_NO_SPACE_IN_FROM'] = { re = 'From=/\\S<[-\\w\\.]+\\@[-\\w\\.]+>/X', |