diff options
| author | 2025-12-13 11:31:34 +0100 | |
|---|---|---|
| committer | 2025-12-13 11:31:34 +0100 | |
| commit | a8a544a2a205b42d2009b5c52d8939e8bc36263c (patch) | |
| tree | 27922ce7e14eec886cb0348aeb2501c3dceecf9c /tests | |
| parent | b66d4ade4160b0f13efa4fb48a6c27884ad81804 (diff) | |
Fix search encoding and quoting (#8311)
Revised the encoding approach for searches: the HTML encoding is done just before its use for DB search.
Fix also some cases with wrong quoting.
Fix https://github.com/FreshRSS/FreshRSS/pull/8306#issuecomment-3643865439
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8293
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/app/Models/SearchTest.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 92024c7b6..a543777ef 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -65,6 +65,7 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { ["intitle:'word1 word2' word3'", ['word1 word2'], ["word3'"]], ['intitle:"word1 word2\' word3"', ["word1 word2' word3"], null], ["intitle:'word1 word2\" word3'", ['word1 word2" word3'], null], + ['intitle:"< & >"', ['< & >'], null], ["intitle:word1 'word2 word3' word4", ['word1'], ['word2 word3', 'word4']], ['intitle:word1+word2', ['word1+word2'], null], ]; @@ -561,10 +562,9 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { ['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%', '%gh%', '%ij%', '%ij%', '%kl%', '%kl%'] ], [ - '"ab" "cd" ("ef") intitle:"gh" !"ij" -"kl"', - '(((e.title LIKE ? OR e.content LIKE ?) AND (e.title LIKE ? OR e.content LIKE ?) )) AND (((e.title LIKE ? OR e.content LIKE ?) )) ' . - 'AND ((e.title LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? AND e.title NOT LIKE ? AND e.content NOT LIKE ? ))', - ['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%', '%gh%', '%ij%', '%ij%', '%kl%', '%kl%'] + 'intitle:"é & \' è" intext:/<&>/ \'< & " >\'', + '(e.title LIKE ? AND e.content ~ ? AND (e.title LIKE ? OR e.content LIKE ?) )', + ['%é & \' è%', '<&>', '%< & " >%', '%< & " >%'] ], [ '/^(ab|cd) [(] \\) (ef|gh)/', @@ -934,8 +934,8 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { userdate:2025-01-01T00:00:00/2026-01-01T00:00:00 pubdate:2025-02-01T00:00:00/2026-01-01T00:00:00 date:2025-03-01T00:00:00/2026-01-01T00:00:00 - intitle:/Interesting/i intitle:good - intext:/Interesting/i intext:good + intitle:/<Inter&sting>/i intitle:"g ' & d" + intext:/<Inter&sting>/i intext:g&d author:/Bob/ author:Alice inurl:/https/ inurl:example.net #/tag2/ #tag1 @@ -944,8 +944,8 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { -userdate:2025-06-01T00:00:00/2025-09-01T00:00:00 -pubdate:2025-06-01T00:00:00/2025-09-01T00:00:00 -date:2025-06-01T00:00:00/2025-09-01T00:00:00 - -intitle:/Spam/i -intitle:bad - -intext:/Spam/i -intext:bad + -intitle:/Spam/i -intitle:"'bad" + -intext:/Spam/i -intext:"'bad" -author:/Dave/i -author:Charlie -inurl:/ftp/ -inurl:example.com -#/tag4/ -#tag3 |
