[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
This commit is contained in:
fulmeek 2019-06-01 19:36:46 +02:00 committed by LogMANOriginal
parent b889e867fd
commit 66c5b732cf

View file

@ -418,6 +418,9 @@ class FeedItem {
if(!is_string($uid)) { if(!is_string($uid)) {
Debug::log('Unique id must be a string!'); 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 { } else {
$this->uid = sha1($uid); $this->uid = sha1($uid);
} }