summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-07-25 00:08:06 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-07-25 00:08:06 +0200
commitb655fc74e433df15f61a00963581f2775e9ddbc1 (patch)
treeb000b0eaa2a712380ed99c8bcc85013924dfb92e
parentedab5dd72350785a9fed85d068704381181be791 (diff)
decode title twice to fix stupid feed authors' mistakes
-rw-r--r--CHANGELOG3
-rw-r--r--tests/unit/utility/FeedFetcherTest.php4
-rw-r--r--utility/feedfetcher.php9
3 files changed, 12 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2ca232cb2..bdb08865c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+owncloud-news (1.203)
+* Decode the title twice to fix stupid feed authors' mistakes
+
ownCloud-news (1.202)
* Fixed a bug in the API routes that would request an uneeded id when creating a feed
* Log unimportant errors on debug level instead of error level
diff --git a/tests/unit/utility/FeedFetcherTest.php b/tests/unit/utility/FeedFetcherTest.php
index 1ea06e2ad..94d410453 100644
--- a/tests/unit/utility/FeedFetcherTest.php
+++ b/tests/unit/utility/FeedFetcherTest.php
@@ -104,7 +104,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$this->url = 'tests';
$this->permalink = 'http://permalink';
- $this->title = 'my title&lt;';
+ $this->title = 'my title&amp;lt;';
$this->guid = 'hey guid here';
$this->body = 'let the bodies hit the floor <a href="test">test</a>';
$this->body2 = 'let the bodies hit the floor <a target="_blank" href="test">test</a>';
@@ -196,7 +196,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$item->setStatus(0);
$item->setUnread();
$item->setUrl($this->permalink);
- $item->setTitle(html_entity_decode($this->title));
+ $item->setTitle(html_entity_decode(html_entity_decode($this->title)));
$item->setGuid($this->guid);
$item->setGuidHash(md5($this->guid));
$item->setBody($this->body2);
diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php
index 4706f7612..c3568ab63 100644
--- a/utility/feedfetcher.php
+++ b/utility/feedfetcher.php
@@ -118,8 +118,13 @@ class FeedFetcher implements IFeedFetcher {
$item->setUrl(html_entity_decode($simplePieItem->get_permalink(),
ENT_COMPAT, 'UTF-8'));
// unescape content because angularjs helps against XSS
- $item->setTitle(html_entity_decode($simplePieItem->get_title(),
- ENT_COMPAT, 'UTF-8'));
+ // unescape again to clean up fucktard's RSS feeds who escape twice
+ // (I'm looking at you slashdot)
+ $item->setTitle(
+ html_entity_decode(
+ html_entity_decode($simplePieItem->get_title(), ENT_COMPAT, 'UTF-8'),
+ ENT_COMPAT, 'UTF-8')
+ );
$guid = $simplePieItem->get_id();
$item->setGuid($guid);
$item->setGuidHash(md5($guid));