Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/EntrySearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 10 additions & 0 deletions tests/TestEntrySearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down