Skip to content

Fix HTML encoding breaking search in preview filters#8222

Closed
Inverle wants to merge 3 commits intoFreshRSS:edgefrom
Inverle:fix-html-encoding-filteractions
Closed

Fix HTML encoding breaking search in preview filters#8222
Inverle wants to merge 3 commits intoFreshRSS:edgefrom
Inverle:fix-html-encoding-filteractions

Conversation

@Inverle
Copy link
Member

@Inverle Inverle commented Nov 16, 2025

Follow-up of #7959


image

wrongly resulted in

image

@Inverle Inverle added this to the 1.28.0 milestone Nov 16, 2025
@Inverle Inverle added the Bug (confirmed) 🐞 issues that are reproducible label Nov 16, 2025
@Inverle Inverle marked this pull request as draft November 16, 2025 18:20
@Inverle Inverle marked this pull request as ready for review November 16, 2025 18:49
@Inverle Inverle requested a review from Alkarex November 16, 2025 18:49
@Alkarex
Copy link
Member

Alkarex commented Nov 18, 2025

This PR does not work at the moment. Quick test with intitle:" & " which expects to filter & (with space on each side) in the title, and which does not work anymore. Since the title is saved in database as HTML, the search input must also be as HTML, i.e. &

@Alkarex
Copy link
Member

Alkarex commented Nov 18, 2025

I think the place to fix instead is:

$search = "c:$id (";
foreach ($filteractions as $action) {
$search .= "($action) OR ";
}
$search = preg_replace('/ OR $/', '', $search);
$search .= ')';

By building a BooleanSearch instead of only manual strings:

/** @param FreshRSS_BooleanSearch|FreshRSS_Search $search */
public function add(FreshRSS_BooleanSearch|FreshRSS_Search $search): void {
$this->searches[] = $search;
}

Alternatively, inspired by the following (which could likely be improved):

if ($level === 0) {
$input = preg_replace('/:"(.*?)"/', ':"\1"', $input);
if (!is_string($input)) {
return;
}
$input = preg_replace('/(?<=[\s(!-]|^)&quot;(.*?)&quot;/', '"\1"', $input);
if (!is_string($input)) {
return;
}
}

@Inverle Inverle marked this pull request as draft November 20, 2025 21:18
Alkarex added a commit to Alkarex/FreshRSS that referenced this pull request Nov 28, 2025
@Alkarex
Copy link
Member

Alkarex commented Nov 28, 2025

Alternative in #8259
Tests welcome

@Inverle Inverle closed this Dec 3, 2025
Alkarex added a commit that referenced this pull request Dec 3, 2025
@Inverle Inverle deleted the fix-html-encoding-filteractions branch December 3, 2025 23:05
Alkarex added a commit that referenced this pull request Dec 17, 2025
Rework:
* #8222

now that we have:
* #8293

Follow-up of:
* #8311

* More simplification

* Deprecate getRawInput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug (confirmed) 🐞 issues that are reproducible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments