From 822fe1f91b065959aaf478a92899923b6cf4a512 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Fri, 12 Mar 2021 20:09:16 +0300 Subject: [PATCH] fix: fixed message filtering by fields in case of duplicate fields --- src/model.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/model.rs b/src/model.rs index 7a3697e6..d209177b 100644 --- a/src/model.rs +++ b/src/model.rs @@ -80,25 +80,20 @@ impl<'a> Record<'a> { } } _ => { - let mut found = false; + let mut matched = false; for (k, v) in self.extra.iter() { match field.match_key(*k) { None => {} Some(KeyMatch::Full) => { - found = true; - if !field.match_value(Some(v.get()), v.get().starts_with('"')) { - return false; - } + let escaped = v.get().starts_with('"'); + matched |= field.match_value(Some(v.get()), escaped); } Some(KeyMatch::Partial(subkey)) => { - found = true; - if !field.match_value_partial(subkey, *v) { - return false; - } + matched |= field.match_value_partial(subkey, *v); } } } - if !found { + if !matched { return false; } }