Skip to content

Commit

Permalink
[FeedItem] Avoid repeated UID hashing after loading from cache (RSS-B…
Browse files Browse the repository at this point in the history
…ridge#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
  • Loading branch information
fulmeek authored and logmanoriginal committed Jun 1, 2019
1 parent 21e4dd9 commit 0817f2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/FeedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ public function setUid($uid) {

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);
}
Expand Down

0 comments on commit 0817f2b

Please sign in to comment.