Skip to content

Commit

Permalink
lib: query-processor: fix handling unknown flags
Browse files Browse the repository at this point in the history
Fixes #2567.
  • Loading branch information
djcb committed Oct 9, 2023
1 parent 6e45609 commit f4a930c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/mu-query-processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ basify(Element&& element)
auto val{str->substr(pos + 1)};
if (field == Field::Id::Flags) {
if (auto&& finfo{flag_info(val)}; finfo)
element.value = Element::Basic{field->name,
element.value = Element::Basic{field->name,
std::string{finfo->name}};
else
Element::Basic{*str};
element.value = Element::Basic{*str};
} else if (field == Field::Id::Priority) {
if (auto&& prio{priority_from_name(val)}; prio)
element.value = Element::Basic{field->name,
Expand Down Expand Up @@ -444,7 +444,6 @@ process(const std::string& expr)
.and_then(opify)
.and_then(basify)
.and_then(regexpify)
//.and_then(phrasify)
.and_then(wildcardify)
.and_then(rangify);
if (element)
Expand Down Expand Up @@ -490,6 +489,7 @@ main (int argc, char *argv[])

#if BUILD_TESTS
/*
*
* Tests.
*
*/
Expand All @@ -505,6 +505,7 @@ test_processor()
// basics
TestCase{R"(hello world)", R"(((_ "hello") (_ "world")))"},
TestCase{R"(maildir:/"hello world")", R"(((maildir "/hello world")))"},
TestCase{R"(flag:deleted)", R"(((_ "flag:deleted")))"} // non-existing flags
};

for (auto&& test: cases) {
Expand Down

0 comments on commit f4a930c

Please sign in to comment.