From 66c5b732cf21dff54908a2e3091ec9d8b0a2cc80 Mon Sep 17 00:00:00 2001 From: fulmeek <36341513+fulmeek@users.noreply.github.com> Date: Sat, 1 Jun 2019 19:36:46 +0200 Subject: [PATCH] [FeedItem] Avoid repeated UID hashing after loading from cache (#1148) 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 b0095be2..9a435730 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -418,6 +418,9 @@ class FeedItem { if(!is_string($uid)) { Debug::log('Unique id must be a string!'); + } elseif (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); }