aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2021-02-19 18:30:18 -0500
committerGravatar GitHub <noreply@github.com> 2021-02-20 00:30:18 +0100
commit9682fcfebbeeb4e02174cbae061b003d1017f6ab (patch)
tree1b7f7c7defcb454b23edb6a4a7ef2e5c46156f61 /app
parent0e6ad01dbfc396bee63f2e100df75bcd6488ed16 (diff)
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
Diffstat (limited to 'app')
-rw-r--r--app/Models/Entry.php6
1 files 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 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: