From ac9c17c7b80d931895d1fb822af2c43861bd2559 Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Tue, 6 Jan 2026 17:32:24 +0700 Subject: [PATCH 1/8] fix: keep trashbin cache and db in sync Signed-off-by: Hoang Pham --- apps/files_trashbin/lib/Trashbin.php | 77 ++++++++++++++++++----- apps/files_trashbin/tests/StorageTest.php | 19 ++++++ 2 files changed, 80 insertions(+), 16 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index ea9d7496c5b..54f8a44b96b 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -309,6 +309,8 @@ class Trashbin implements IEventListener { $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); if ($inCache) { $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + } else { + $trashStorage->getUpdater()->update($trashInternalPath); } } catch (CopyRecursiveException $e) { $moveSuccessful = false; @@ -345,18 +347,51 @@ class Trashbin implements IEventListener { ->setValue('location', $query->createNamedParameter($location)) ->setValue('user', $query->createNamedParameter($owner)) ->setValue('deleted_by', $query->createNamedParameter($deletedBy)); - $result = $query->executeStatement(); - if (!$result) { - Server::get(LoggerInterface::class)->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); + $inserted = false; + try { + $inserted = ($query->executeStatement() === 1); + } catch (\Throwable $e) { + Server::get(LoggerInterface::class)->error( + 'trash bin database insert failed', + [ + 'app' => 'files_trashbin', + 'exception' => $e, + 'user' => $owner, + 'filename' => $filename, + 'timestamp' => $timestamp, + ] + ); } - Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), - 'trashPath' => Filesystem::normalizePath(static::getTrashFilename($filename, $timestamp))]); + if (!$inserted) { + Server::get(LoggerInterface::class)->error( + 'trash bin database couldn\'t be updated, removing trash payload', + [ + 'app' => 'files_trashbin', + 'user' => $owner, + 'filename' => $filename, + 'timestamp' => $timestamp, + ] + ); + if ($trashStorage->file_exists($trashInternalPath)) { + if ($trashStorage->is_dir($trashInternalPath)) { + $trashStorage->rmdir($trashInternalPath); + } else { + $trashStorage->unlink($trashInternalPath); + } + } + $trashStorage->getUpdater()->remove($trashInternalPath); + $moveSuccessful = false; + } + if ($inserted) { + Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), + 'trashPath' => Filesystem::normalizePath(static::getTrashFilename($filename, $timestamp))]); - self::retainVersions($filename, $owner, $ownerPath, $timestamp); + self::retainVersions($filename, $owner, $ownerPath, $timestamp); - // if owner !== user we need to also add a copy to the users trash - if ($user !== $owner && $ownerOnly === false) { - self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp); + // if owner !== user we need to also add a copy to the users trash + if ($user !== $owner && $ownerOnly === false) { + self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp); + } } } @@ -689,13 +724,6 @@ class Trashbin implements IEventListener { $size = 0; if ($timestamp) { - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->delete('files_trash') - ->where($query->expr()->eq('user', $query->createNamedParameter($user))) - ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) - ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); - $query->executeStatement(); - $file = static::getTrashFilename($filename, $timestamp); } else { $file = $filename; @@ -706,6 +734,14 @@ class Trashbin implements IEventListener { try { $node = $userRoot->get('/files_trashbin/files/' . $file); } catch (NotFoundException $e) { + if ($timestamp) { + $query = Server::get(IDBConnection::class)->getQueryBuilder(); + $query->delete('files_trash') + ->where($query->expr()->eq('user', $query->createNamedParameter($user))) + ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) + ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); + $query->executeStatement(); + } return $size; } @@ -719,6 +755,15 @@ class Trashbin implements IEventListener { $node->delete(); self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); + if ($timestamp) { + $query = Server::get(IDBConnection::class)->getQueryBuilder(); + $query->delete('files_trash') + ->where($query->expr()->eq('user', $query->createNamedParameter($user))) + ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) + ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); + $query->executeStatement(); + } + return $size; } diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index de8df1d2932..f0e6631e600 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -118,6 +118,25 @@ class StorageTest extends \Test\TestCase { $this->assertEquals('test.txt', substr($name, 0, strrpos($name, '.'))); } + public function testTrashEntryCreatedWhenSourceNotInCache(): void { + $this->userView->file_put_contents('uncached.txt', 'foo'); + + [$storage, $internalPath] = $this->userView->resolvePath('uncached.txt'); + $cache = $storage->getCache(); + $cache->remove($internalPath); + $this->assertFalse($cache->inCache($internalPath)); + + $this->userView->unlink('uncached.txt'); + + $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/'); + $this->assertCount(1, $results); + $name = $results[0]->getName(); + $this->assertEquals('uncached.txt', substr($name, 0, strrpos($name, '.'))); + + [$trashStorage, $trashInternalPath] = $this->rootView->resolvePath('/' . $this->user . '/files_trashbin/files/' . $name); + $this->assertTrue($trashStorage->getCache()->inCache($trashInternalPath)); + } + /** * Test that deleting a folder puts it into the trashbin. */ From eedd8dce3ca68b4492cf46d02575f1ef3497a485 Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Tue, 6 Jan 2026 18:40:21 +0700 Subject: [PATCH 2/8] fix(trashbin): keep metadata consistent on move Signed-off-by: Hoang Pham --- apps/files_trashbin/lib/Trashbin.php | 134 ++++++++++++++++----------- 1 file changed, 78 insertions(+), 56 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 54f8a44b96b..6cc88cb0410 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -299,12 +299,60 @@ class Trashbin implements IEventListener { $configuredTrashbinSize = static::getConfiguredTrashbinSize($owner); if ($configuredTrashbinSize >= 0 && $sourceInfo->getSize() >= $configuredTrashbinSize) { + $trashStorage->releaseLock($trashInternalPath, ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); return false; } - try { - $moveSuccessful = true; + // there is still a possibility that the file has been deleted by a remote user + $deletedBy = self::overwriteDeletedBy($user); + $deleteTrashRow = static function () use ($owner, $filename, $timestamp): void { + $query = Server::get(IDBConnection::class)->getQueryBuilder(); + $query->delete('files_trash') + ->where($query->expr()->eq('user', $query->createNamedParameter($owner))) + ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) + ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); + $query->executeStatement(); + }; + + $query = Server::get(IDBConnection::class)->getQueryBuilder(); + $query->insert('files_trash') + ->setValue('id', $query->createNamedParameter($filename)) + ->setValue('timestamp', $query->createNamedParameter($timestamp)) + ->setValue('location', $query->createNamedParameter($location)) + ->setValue('user', $query->createNamedParameter($owner)) + ->setValue('deleted_by', $query->createNamedParameter($deletedBy)); + $inserted = false; + try { + $inserted = ($query->executeStatement() === 1); + } catch (\Throwable $e) { + Server::get(LoggerInterface::class)->error( + 'trash bin database insert failed', + [ + 'app' => 'files_trashbin', + 'exception' => $e, + 'user' => $owner, + 'filename' => $filename, + 'timestamp' => $timestamp, + ] + ); + } + if (!$inserted) { + Server::get(LoggerInterface::class)->error( + 'trash bin database couldn\'t be updated, skipping trash move', + [ + 'app' => 'files_trashbin', + 'user' => $owner, + 'filename' => $filename, + 'timestamp' => $timestamp, + ] + ); + $trashStorage->releaseLock($trashInternalPath, ILockingProvider::LOCK_EXCLUSIVE, $lockingProvider); + return false; + } + + $moveSuccessful = true; + try { $inCache = $sourceStorage->getCache()->inCache($sourceInternalPath); $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); if ($inCache) { @@ -333,65 +381,39 @@ class Trashbin implements IEventListener { } else { $trashStorage->getUpdater()->remove($trashInternalPath); } - return false; + $moveSuccessful = false; + } + + if (!$moveSuccessful) { + Server::get(LoggerInterface::class)->error( + 'trash move failed, removing trash metadata and payload', + [ + 'app' => 'files_trashbin', + 'user' => $owner, + 'filename' => $filename, + 'timestamp' => $timestamp, + ] + ); + $deleteTrashRow(); + if ($trashStorage->file_exists($trashInternalPath)) { + if ($trashStorage->is_dir($trashInternalPath)) { + $trashStorage->rmdir($trashInternalPath); + } else { + $trashStorage->unlink($trashInternalPath); + } + } + $trashStorage->getUpdater()->remove($trashInternalPath); } if ($moveSuccessful) { - // there is still a possibility that the file has been deleted by a remote user - $deletedBy = self::overwriteDeletedBy($user); + Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), + 'trashPath' => Filesystem::normalizePath(static::getTrashFilename($filename, $timestamp))]); - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->insert('files_trash') - ->setValue('id', $query->createNamedParameter($filename)) - ->setValue('timestamp', $query->createNamedParameter($timestamp)) - ->setValue('location', $query->createNamedParameter($location)) - ->setValue('user', $query->createNamedParameter($owner)) - ->setValue('deleted_by', $query->createNamedParameter($deletedBy)); - $inserted = false; - try { - $inserted = ($query->executeStatement() === 1); - } catch (\Throwable $e) { - Server::get(LoggerInterface::class)->error( - 'trash bin database insert failed', - [ - 'app' => 'files_trashbin', - 'exception' => $e, - 'user' => $owner, - 'filename' => $filename, - 'timestamp' => $timestamp, - ] - ); - } - if (!$inserted) { - Server::get(LoggerInterface::class)->error( - 'trash bin database couldn\'t be updated, removing trash payload', - [ - 'app' => 'files_trashbin', - 'user' => $owner, - 'filename' => $filename, - 'timestamp' => $timestamp, - ] - ); - if ($trashStorage->file_exists($trashInternalPath)) { - if ($trashStorage->is_dir($trashInternalPath)) { - $trashStorage->rmdir($trashInternalPath); - } else { - $trashStorage->unlink($trashInternalPath); - } - } - $trashStorage->getUpdater()->remove($trashInternalPath); - $moveSuccessful = false; - } - if ($inserted) { - Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), - 'trashPath' => Filesystem::normalizePath(static::getTrashFilename($filename, $timestamp))]); + self::retainVersions($filename, $owner, $ownerPath, $timestamp); - self::retainVersions($filename, $owner, $ownerPath, $timestamp); - - // if owner !== user we need to also add a copy to the users trash - if ($user !== $owner && $ownerOnly === false) { - self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp); - } + // if owner !== user we need to also add a copy to the users trash + if ($user !== $owner && $ownerOnly === false) { + self::copyFilesToUser($ownerPath, $owner, $file_path, $user, $timestamp); } } From b7150ad88ce8cf8b7a78c33d250218a9b750e03b Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Tue, 6 Jan 2026 18:40:41 +0700 Subject: [PATCH 3/8] perf(trashbin): avoid full rescan for uncached moves Signed-off-by: Hoang Pham --- apps/files_trashbin/lib/Trashbin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 6cc88cb0410..b756f33a8d4 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -358,7 +358,11 @@ class Trashbin implements IEventListener { if ($inCache) { $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); } else { - $trashStorage->getUpdater()->update($trashInternalPath); + $sizeDifference = $sourceInfo->getSize(); + if ($sizeDifference < 0) { + $sizeDifference = null; + } + $trashStorage->getUpdater()->update($trashInternalPath, null, $sizeDifference); } } catch (CopyRecursiveException $e) { $moveSuccessful = false; From 7eae0e5f8cad6db6b3388c6031c61056610e0e69 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 1 Apr 2026 18:09:29 +0200 Subject: [PATCH 4/8] chore: deduplicate trashbin row delete logic Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 41 +++++++++------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index b756f33a8d4..39532a827b6 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -306,15 +306,6 @@ class Trashbin implements IEventListener { // there is still a possibility that the file has been deleted by a remote user $deletedBy = self::overwriteDeletedBy($user); - $deleteTrashRow = static function () use ($owner, $filename, $timestamp): void { - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->delete('files_trash') - ->where($query->expr()->eq('user', $query->createNamedParameter($owner))) - ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) - ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); - $query->executeStatement(); - }; - $query = Server::get(IDBConnection::class)->getQueryBuilder(); $query->insert('files_trash') ->setValue('id', $query->createNamedParameter($filename)) @@ -398,7 +389,7 @@ class Trashbin implements IEventListener { 'timestamp' => $timestamp, ] ); - $deleteTrashRow(); + self::deleteTrashRow($user, $filename, $timestamp); if ($trashStorage->file_exists($trashInternalPath)) { if ($trashStorage->is_dir($trashInternalPath)) { $trashStorage->rmdir($trashInternalPath); @@ -606,12 +597,7 @@ class Trashbin implements IEventListener { self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); if ($timestamp) { - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->delete('files_trash') - ->where($query->expr()->eq('user', $query->createNamedParameter($user))) - ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) - ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); - $query->executeStatement(); + self::deleteTrashRow($user, $filename, $timestamp); } return true; @@ -761,12 +747,7 @@ class Trashbin implements IEventListener { $node = $userRoot->get('/files_trashbin/files/' . $file); } catch (NotFoundException $e) { if ($timestamp) { - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->delete('files_trash') - ->where($query->expr()->eq('user', $query->createNamedParameter($user))) - ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) - ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); - $query->executeStatement(); + self::deleteTrashRow($user, $filename, $timestamp); } return $size; } @@ -782,17 +763,21 @@ class Trashbin implements IEventListener { self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); if ($timestamp) { - $query = Server::get(IDBConnection::class)->getQueryBuilder(); - $query->delete('files_trash') - ->where($query->expr()->eq('user', $query->createNamedParameter($user))) - ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) - ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); - $query->executeStatement(); + self::deleteTrashRow($user, $filename, $timestamp); } return $size; } + private static function deleteTrashRow(string $user, string $filename, int $timestamp): void { + $query = Server::get(IDBConnection::class)->getQueryBuilder(); + $query->delete('files_trash') + ->where($query->expr()->eq('user', $query->createNamedParameter($user))) + ->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename))) + ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); + $query->executeStatement(); + } + /** * @param string $file * @param string $filename From 921ee170262b02bf551760c962601e4805cf4da8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 1 Apr 2026 18:55:00 +0200 Subject: [PATCH 5/8] test: add test for trashbin when cross-storage move fails Signed-off-by: Robin Appelman --- apps/files_trashbin/tests/StorageTest.php | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index f0e6631e600..90a28af398a 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -6,16 +6,20 @@ declare(strict_types=1); * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OCA\Files_Trashbin\Tests; +use OC\Files\Cache\Updater; use OC\Files\Filesystem; use OC\Files\Storage\Common; +use OC\Files\Storage\Local; use OC\Files\Storage\Temporary; use OC\Files\View; use OCA\Files_Trashbin\AppInfo\Application; use OCA\Files_Trashbin\Events\MoveToTrashEvent; use OCA\Files_Trashbin\Storage; use OCA\Files_Trashbin\Trash\ITrashManager; +use OCA\Files_Trashbin\Trashbin; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Constants; @@ -137,6 +141,62 @@ class StorageTest extends \Test\TestCase { $this->assertTrue($trashStorage->getCache()->inCache($trashInternalPath)); } + public function testTrashEntryNotCreatedWhenDeleteFailed(): void { + $storage2 = $this->getMockBuilder(Temporary::class) + ->setConstructorArgs([]) + ->onlyMethods(['unlink', 'instanceOfStorage']) + ->getMock(); + $storage2->method('unlink') + ->willReturn(false); + + // disable same-storage move optimization + $storage2->method('instanceOfStorage') + ->willReturnCallback(fn (string $class) => ($class !== Local::class) && (new Temporary([]))->instanceOfStorage($class)); + + + Filesystem::mount($storage2, [], $this->user . '/files/substorage'); + $this->userView->file_put_contents('substorage/test.txt', 'foo'); + + $this->assertFalse($this->userView->unlink('substorage/test.txt')); + + $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/'); + $this->assertEmpty($results); + + $trashData = Trashbin::getExtraData($this->user); + $this->assertEmpty($trashData); + } + + public function testTrashEntryNotCreatedWhenCacheRowFailed(): void { + $trashStorage = $this->getMockBuilder(Temporary::class) + ->setConstructorArgs([]) + ->onlyMethods(['getUpdater']) + ->getMock(); + $updater = $this->getMockBuilder(Updater::class) + ->setConstructorArgs([$trashStorage]) + ->onlyMethods(['renameFromStorage']) + ->getMock(); + $trashStorage->method('getUpdater') + ->willReturn($updater); + $updater->method('renameFromStorage') + ->willThrowException(new \Exception()); + + Filesystem::mount($trashStorage, [], $this->user . '/files_trashbin'); + $this->userView->file_put_contents('test.txt', 'foo'); + + try { + $this->assertFalse($this->userView->unlink('test.txt')); + $this->fail(); + } catch (\Exception) { + // expected + } + + $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/'); + $this->assertEmpty($results); + + $trashData = Trashbin::getExtraData($this->user); + $this->assertEmpty($trashData); + } + /** * Test that deleting a folder puts it into the trashbin. */ From b76cdd09ccfe02c148fa6e31c26369b18c1976c7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 1 Apr 2026 19:17:25 +0200 Subject: [PATCH 6/8] fix: catch all exceptions during trashbin cache move Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 39532a827b6..cf90f85cfa3 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -355,7 +355,7 @@ class Trashbin implements IEventListener { } $trashStorage->getUpdater()->update($trashInternalPath, null, $sizeDifference); } - } catch (CopyRecursiveException $e) { + } catch (\Exception $e) { $moveSuccessful = false; if ($trashStorage->file_exists($trashInternalPath)) { $trashStorage->unlink($trashInternalPath); From 966db54089e2ccdd03dc6e9d52b19b2818511486 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 1 Apr 2026 19:25:27 +0200 Subject: [PATCH 7/8] chore: psalm fix Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index cf90f85cfa3..7aa40528961 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -352,6 +352,8 @@ class Trashbin implements IEventListener { $sizeDifference = $sourceInfo->getSize(); if ($sizeDifference < 0) { $sizeDifference = null; + } else { + $sizeDifference = (int)$sizeDifference; } $trashStorage->getUpdater()->update($trashInternalPath, null, $sizeDifference); } From 0317e002f3d801d13298eab3dc113701136fd328 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 1 Apr 2026 20:23:42 +0200 Subject: [PATCH 8/8] test: skip testTrashEntryCreatedWhenSourceNotInCache on object store Signed-off-by: Robin Appelman --- apps/files_trashbin/tests/StorageTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 90a28af398a..14a0af0697b 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -11,6 +11,7 @@ namespace OCA\Files_Trashbin\Tests; use OC\Files\Cache\Updater; use OC\Files\Filesystem; +use OC\Files\ObjectStore\ObjectStoreStorage; use OC\Files\Storage\Common; use OC\Files\Storage\Local; use OC\Files\Storage\Temporary; @@ -126,6 +127,9 @@ class StorageTest extends \Test\TestCase { $this->userView->file_put_contents('uncached.txt', 'foo'); [$storage, $internalPath] = $this->userView->resolvePath('uncached.txt'); + if ($storage->instanceOfStorage(ObjectStoreStorage::class)) { + $this->markTestSkipped('object store always has the file in cache'); + } $cache = $storage->getCache(); $cache->remove($internalPath); $this->assertFalse($cache->inCache($internalPath));