Add full content delimiter and action (#3463)

Before, when appending or prepending the content of the CSS selector
content, it was added to the content. It was working fine for the
first call but every subsequent calls were pilling the retrieved
content on top of the already retrieved content. Thus we had an ever
growing content with a lot of duplication.
Now, the CSS selector content is identified by an HTML comment which
is used to remove the content for every subsequent calls.

The bug was introduced in #3453
This commit is contained in:
Alexis Degrugillier
2021-02-19 18:30:18 -05:00
committed by GitHub
parent 0e6ad01dbf
commit 9682fcfebb

View File

@@ -447,12 +447,14 @@ class FreshRSS_Entry extends Minz_Model {
$feed->attributes()
);
if ('' !== $fullContent) {
$fullContent = "<!-- FULLCONTENT start //-->{$fullContent}<!-- FULLCONTENT end //-->";
$originalContent = preg_replace('#<!-- FULLCONTENT start //-->.*<!-- FULLCONTENT end //-->#s', '', $this->content());
switch ($feed->attributes('content_action')) {
case 'prepend':
$this->content = $fullContent . $this->content();
$this->content = $fullContent . $originalContent;
break;
case 'append':
$this->content = $this->content() . $fullContent;
$this->content = $originalContent . $fullContent;
break;
case 'replace':
default: