From 1ed7a0ef98355f903e6ab262196a3456f505aa87 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 19 Feb 2026 08:38:04 +0100 Subject: [PATCH] fix(TransferOwnershipService): Remove groupfolders size Signed-off-by: provokateurin --- .../lib/Service/OwnershipTransferService.php | 23 +++++++++++++++++++ psalm.xml | 1 + 2 files changed, 24 insertions(+) diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 581d5a1294801..5ee25e98ea8b6 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -17,6 +17,7 @@ use OCA\Encryption\Util; use OCA\Files\Exception\TransferOwnershipException; use OCA\Files_External\Config\ConfigAdapter; +use OCA\GroupFolders\Mount\GroupMountPoint; use OCP\Encryption\IManager as IEncryptionManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IHomeMountProvider; @@ -169,6 +170,28 @@ public function transfer( ); $sizeDifference = $sourceSize - $view->getFileInfo($finalTarget)->getSize(); + // Files in Team folders are not transferred, so their size needs to be subtracted to avoid warnings about size differences + $mounts = Server::get(IMountManager::class)->getAll(); + foreach ($mounts as $mount) { + if (!$mount instanceof GroupMountPoint || !str_starts_with($mount->getMountPoint(), '/' . $sourcePath . '/')) { + continue; + } + + $storage = $mount->getStorage(); + if ($storage === null) { + $output->writeln('Failed to get storage for mount: ' . $mount->getMountPoint()); + continue; + } + + $rootCacheEntry = $storage->getCache()->get(''); + if ($rootCacheEntry === false) { + $output->writeln('Failed to get root cache entry for storage: ' . $mount->getMountPoint()); + continue; + } + + $sizeDifference -= $rootCacheEntry->getSize(); + } + // transfer the incoming shares $sourceShares = $this->collectIncomingShares( $sourceUid, diff --git a/psalm.xml b/psalm.xml index 576c482532cd5..9b029ce31d497 100644 --- a/psalm.xml +++ b/psalm.xml @@ -114,6 +114,7 @@ +