diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-05-31 15:04:51 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-05-31 15:04:51 +0100 |
commit | 60e234c400d1063db48d2ac42e46329ef148d32e (patch) | |
tree | a5f113b101a4c1c68d24edb5b27e3b4ea95d60ec /src | |
parent | fc39102a7d601620b8e0992d4b8f7f879689e7a0 (diff) | |
download | rspamd-60e234c400d1063db48d2ac42e46329ef148d32e.tar.gz rspamd-60e234c400d1063db48d2ac42e46329ef148d32e.zip |
[Minor] Compare parts with many words by just using their length
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/message.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index af8ad0e56..bdc1378d9 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -585,9 +585,17 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, s2len = w2->len; if (s1len + s2len > max_words) { - msg_err_task ("cannot compare parts with more than %ud words: (%ud + %ud)", + msg_info_task ("cannot direct compare multipart/alternative parts with more than %ud words in total: " + "(%ud words in one part and %ud in another)", max_words, s1len, s2len); - return 0; + + /* Use approximate comparison of number of words */ + if (s1len > s2len) { + return s1len - s2len; + } + else { + return s2len - s1len; + } } column = g_malloc0 ((s1len + 1) * sizeof (guint)); |