From d41983ff74644e9e707fee24577412a4285ebcd2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Nov 2024 17:13:43 +0100 Subject: [PATCH] fix: don't propagate future mtimes Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Propagator.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index cdf9ca9991a1f..0ca9c38f6b538 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -13,6 +13,8 @@ use OCP\Files\Cache\IPropagator; use OCP\Files\Storage\IReliableEtagStorage; use OCP\IDBConnection; +use OCP\Server; +use Psr\Clock\ClockInterface; use Psr\Log\LoggerInterface; /** @@ -39,10 +41,13 @@ class Propagator implements IPropagator { */ private $ignore = []; + private ClockInterface $clock; + public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection, array $ignore = []) { $this->storage = $storage; $this->connection = $connection; $this->ignore = $ignore; + $this->clock = Server::get(ClockInterface::class); } /** @@ -58,6 +63,8 @@ public function propagateChange($internalPath, $time, $sizeDifference = 0) { } } + $time = min($time, $this->clock->now()->getTimestamp()); + $storageId = (int)$this->storage->getStorageCache()->getNumericId(); $parents = $this->getParents($internalPath);