Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/files/lib/Service/OwnershipTransferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
<referencedClass name="OCA\GlobalSiteSelector\Service\SlaveService"/>
<referencedClass name="OCA\Guests\UserBackend"/>
<referencedClass name="OCA\GroupFolders\Mount\GroupMountPoint"/>
</errorLevel>
</UndefinedClass>
<UndefinedFunction>
Expand Down
Loading