From 5d66a8a21ff6a8b8ffecce0296b184558997cf29 Mon Sep 17 00:00:00 2001 From: Abdelrahman Saeed Elhassan Date: Fri, 3 Jul 2026 13:23:45 +0200 Subject: [PATCH] Fix search + prefix modifier ignoring case sensitivity The search parser now passes the CASE_SENSITIVE flag to the term when the '+' prefix modifier is used, so searches like '+p:test1' correctly perform case-sensitive matching. Fixes #13000 [skip ci] --- src/core/EntrySearcher.cpp | 1 + tests/TestEntrySearcher.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/core/EntrySearcher.cpp b/src/core/EntrySearcher.cpp index cb9e135fe3..af6d8f2758 100644 --- a/src/core/EntrySearcher.cpp +++ b/src/core/EntrySearcher.cpp @@ -303,6 +303,7 @@ void EntrySearcher::parseSearchTerms(const QString& searchString) } if (mods.contains("+")) { opts |= Tools::RegexConvertOpts::EXACT_MATCH; + opts |= Tools::RegexConvertOpts::CASE_SENSITIVE; } term.regex = Tools::convertToRegex(term.word, opts); diff --git a/tests/TestEntrySearcher.cpp b/tests/TestEntrySearcher.cpp index 8f16f8462e..3775f6ab5d 100644 --- a/tests/TestEntrySearcher.cpp +++ b/tests/TestEntrySearcher.cpp @@ -150,6 +150,16 @@ void TestEntrySearcher::testSearch() m_searchResult = m_entrySearcher.search("+user:email", m_rootGroup); QCOMPARE(m_searchResult.count(), 0); + // Test that + modifier enforces case sensitivity + m_searchResult = m_entrySearcher.search("+password:testpass", m_rootGroup); + QCOMPARE(m_searchResult.count(), 1); + + m_searchResult = m_entrySearcher.search("+password:Testpass", m_rootGroup); + QCOMPARE(m_searchResult.count(), 0); + + m_searchResult = m_entrySearcher.search("+password:TestPass", m_rootGroup); + QCOMPARE(m_searchResult.count(), 0); + // Terms are logical AND together m_searchResult = m_entrySearcher.search("password:pass user:user", m_rootGroup); QCOMPARE(m_searchResult.count(), 1);