From 5778099ece7a4e6c37c3e0c6950aa0bdf259bcb3 Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Thu, 9 Jan 2020 00:39:28 +0100 Subject: (search) Fix searching tags with spaces Summary: Tags containing blank spaces were not handled properly in the search widget. Now we enclose them in quotes and strip the quotes before setting them to the widget. {F7854247} Test Plan: No artifacts when searching tags containing spaces Added test cases to `bin/dolphinquerytest` Reviewers: #dolphin, elvisangelaccio, ngraham, meven Reviewed By: #dolphin, elvisangelaccio, ngraham Subscribers: meven, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D26369 --- src/search/dolphinfacetswidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/search/dolphinfacetswidget.cpp') diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp index 33c3cea24..d9943abcd 100644 --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -131,7 +131,11 @@ QStringList DolphinFacetsWidget::searchTerms() const if (!m_searchTags.isEmpty()) { for (auto const &tag : m_searchTags) { - terms << QStringLiteral("tag:%1").arg(tag); + if (tag.contains(QLatin1Char(' '))) { + terms << QStringLiteral("tag:\"%1\"").arg(tag); + } else { + terms << QStringLiteral("tag:%1").arg(tag); + } } } -- cgit v1.3