From 6c38c0d8cc03d349cf35195f56c849b236aa0dfb Mon Sep 17 00:00:00 2001 From: Oladosu Ibrahim Date: Sun, 23 Aug 2026 04:10:21 +0000 Subject: [PATCH] Add missing share mount regression test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add focused coverage for repairing a share target when the recipient’s old mount-cache entry is missing, ensuring the repair completes without dereferencing a null mount. Signed-off-by: Oladosu Ibrahim --- .../tests/Repair/CleanupShareTargetTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/files_sharing/tests/Repair/CleanupShareTargetTest.php b/apps/files_sharing/tests/Repair/CleanupShareTargetTest.php index e781a8ec72ef2..ffc095196d36a 100644 --- a/apps/files_sharing/tests/Repair/CleanupShareTargetTest.php +++ b/apps/files_sharing/tests/Repair/CleanupShareTargetTest.php @@ -10,6 +10,7 @@ use OC\Migration\NullOutput; use OCA\Files_Sharing\Repair\CleanupShareTarget; use OCA\Files_Sharing\Tests\TestCase; +use OCP\Files\Config\IUserMountCache; use OCP\Files\NotFoundException; use OCP\Server; use OCP\Share\IShare; @@ -66,6 +67,17 @@ public function testBasicRepair() { $this->assertEquals(self::TEST_FOLDER_NAME, $share->getTarget()); } + public function testRepairWithoutCachedMount() { + $share = $this->createUserShare(self::TEST_FILES_SHARING_API_USER1, self::TEST_FOLDER_NAME . ' (2) (2) (2) (2)'); + $mountPoint = '/' . self::TEST_FILES_SHARING_API_USER2 . '/files' . $share->getTarget() . '/'; + Server::get(IUserMountCache::class)->removeMount($mountPoint); + + $this->cleanupShareTarget->run(new NullOutput()); + + $share = $this->shareManager->getShareById($share->getFullId()); + $this->assertEquals(self::TEST_FOLDER_NAME, $share->getTarget()); + } + public function testRepairConflictFile() { $share = $this->createUserShare(self::TEST_FILES_SHARING_API_USER1, self::TEST_FOLDER_NAME . ' (2) (2) (2) (2)');