]> cloud.milkyroute.net Git - dolphin.git/commit
[search] Fix corner cases when using quotes in filenames
authorIsmael Asensio <isma.af@gmail.com>
Sat, 4 Jul 2020 14:23:24 +0000 (16:23 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 5 Jul 2020 17:15:31 +0000 (17:15 +0000)
commitee97db4dfc10e87f637d8387fb3f4d3590d95697
tree42987295290e46b280801392f1d85e69897c5135
parentec03435022efa72a428a43eb106eaf31f503a9e6
[search] Fix corner cases when using quotes in filenames

The `filename` term in a search query is enclosed into quotes.
As the user can have additional quotes in the search term, there were several
corner cases where the parsing would fail to correctly split the terms

New test cases have been added to cover this possibility
Previous tests still passes to avoid regressions

BEFORE:
```
(filename/quoted) Compared values are not the same
Actual   (query.text()): "xyz\"\""
Expected (expectedText): "\"abc xyz\""

(filename/mixed) Compared values are not the same
Actual   (query.text()): "xyz\" tuv\""
Expected (expectedText): "\"abc xyz\" tuv"

(content+filename/quoted) Compared values are not the same
Actual   (query.text()): "abc xyz xyz\"\""
Expected (expectedText): "abc xyz filename:\"\"abc xyz\"\""
```
src/search/dolphinquery.cpp
src/tests/dolphinquerytest.cpp