Replace path from duplicate messages when the existing path is blank

This commit is contained in:
Deon George 2021-11-25 21:22:36 +11:00
parent ebd1cf8732
commit 871430edf8
2 changed files with 9 additions and 1 deletions

View File

@ -112,7 +112,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
* Open a packet file
*
* @param File $file
* @param Zone|null $zone
* @param System|null $system
* @param bool $use_redis
* @return Packet
* @throws InvalidPacketException

View File

@ -166,6 +166,14 @@ class MessageProcess implements ShouldQueue
if (! $o->msg_crc)
$o->msg_crc = md5($this->msg->message);
// Using filter here, due to earlier bugs - and to get rid of the null values
$o->path = collect($o->getRawOriginal('path'))->filter()->toArray();
// If the path is empty, then its probably because of the previous bug, we'll replace it.
// @todo This duplicate message may have gone via a different path, be nice to record it.
if (! $o->path->count())
$o->path = collect($o->getRawOriginal('path'))->merge($this->msg->pathaddress)->toArray();
$o->seenby = collect($o->getRawOriginal('seenby'))->merge($this->msg->seenaddress)->filter()->toArray();
$o->save();