浏览代码

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
Alexis Degrugillier 5 年之前
父节点
当前提交
9682fcfebb
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      app/Models/Entry.php

+ 4 - 2
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: