From 9682fcfebbeeb4e02174cbae061b003d1017f6ab Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 19 Feb 2021 18:30:18 -0500 Subject: [PATCH] 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 --- app/Models/Entry.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 13c32b7a6..b5b28c97a 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -447,12 +447,14 @@ class FreshRSS_Entry extends Minz_Model { $feed->attributes() ); if ('' !== $fullContent) { + $fullContent = "{$fullContent}"; + $originalContent = preg_replace('#.*#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: