From 9398f4f80727a95dc0cabcd7d59bb07148f9cab2 Mon Sep 17 00:00:00 2001 From: fulmeek <36341513+fulmeek@users.noreply.github.com> Date: Sat, 1 Jun 2019 17:25:42 +0200 Subject: [PATCH 1/2] [FeedItem] avoid repeated UID hashing This fixes the following issue: 1. bridge sets unique ids for the items (ids get hashed) 2. items go to the cache 3. on next run items get loaded from cache 4. these items have different ids because they were hashed again 5. they show up twice in feed reader --- lib/FeedItem.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/FeedItem.php b/lib/FeedItem.php index b0095be28d5..88d7a1d3860 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -418,6 +418,9 @@ public function setUid($uid) { if(!is_string($uid)) { Debug::log('Unique id must be a string!'); + } else if (preg_match('/^[a-f0-9]{40}$/', $uid)) { + // keep id if it already is a SHA-1 hash + $this->uid = $uid; } else { $this->uid = sha1($uid); } From 2a63b1985088c365a787010da2c01d2aab5e9abb Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Sat, 1 Jun 2019 19:33:14 +0200 Subject: [PATCH 2/2] [FeedItem] Use 'elseif' instead of 'else if' --- lib/FeedItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FeedItem.php b/lib/FeedItem.php index 88d7a1d3860..9a435730730 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -418,7 +418,7 @@ public function setUid($uid) { if(!is_string($uid)) { Debug::log('Unique id must be a string!'); - } else if (preg_match('/^[a-f0-9]{40}$/', $uid)) { + } elseif (preg_match('/^[a-f0-9]{40}$/', $uid)) { // keep id if it already is a SHA-1 hash $this->uid = $uid; } else {