mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-02-14 15:31:13 -05:00
Fix search expansion with backslash
fix https://github.com/FreshRSS/FreshRSS/issues/8495
This commit is contained in:
@@ -149,8 +149,12 @@ class FreshRSS_Search implements \Stringable {
|
||||
}
|
||||
|
||||
private static function quote(string $s): string {
|
||||
if (strpbrk($s, ' "\'\\/') !== false || $s === '') {
|
||||
return '"' . addcslashes($s, '\\"') . '"';
|
||||
if (str_starts_with($s, 'S:') || str_starts_with($s, 'search:')) {
|
||||
// Discard user queries
|
||||
return $s;
|
||||
}
|
||||
if (strpbrk($s, ' "\'\\/:') !== false || $s === '') {
|
||||
return '"' . addcslashes($s, '"') . '"';
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
@@ -975,7 +975,7 @@ 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:/<Inter&sting>/i intitle:"g ' & d"
|
||||
intitle:/<Inter&sting>/i intitle:"g ' & d\\:"
|
||||
intext:/<Inter&sting>/i intext:g&d
|
||||
author:/Bob/ author:"/u/Alice" author:Alice
|
||||
inurl:/https/ inurl:example.net
|
||||
|
||||
Reference in New Issue
Block a user