Skip to content

Commit ef3108a

Browse files
provokateurinbackportbot[bot]
authored andcommitted
fix(TransferOwnershipService): Remove groupfolders size
Signed-off-by: provokateurin <kate@provokateurin.de> [skip ci]
1 parent a2eca9d commit ef3108a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,28 @@ public function transfer(
155155
);
156156
$sizeDifference = $sourceSize - $view->getFileInfo($finalTarget)->getSize();
157157

158+
// Files in Team folders are not transferred, so their size needs to be subtracted to avoid warnings about size differences
159+
$mounts = Server::get(IMountManager::class)->getAll();
160+
foreach ($mounts as $mount) {
161+
if (!$mount instanceof GroupMountPoint || !str_starts_with($mount->getMountPoint(), '/' . $sourcePath . '/')) {
162+
continue;
163+
}
164+
165+
$storage = $mount->getStorage();
166+
if ($storage === null) {
167+
$output->writeln('Failed to get storage for mount: ' . $mount->getMountPoint());
168+
continue;
169+
}
170+
171+
$rootCacheEntry = $storage->getCache()->get('');
172+
if ($rootCacheEntry === false) {
173+
$output->writeln('Failed to get root cache entry for storage: ' . $mount->getMountPoint());
174+
continue;
175+
}
176+
177+
$sizeDifference -= $rootCacheEntry->getSize();
178+
}
179+
158180
// transfer the incoming shares
159181
$sourceShares = $this->collectIncomingShares(
160182
$sourceUid,

0 commit comments

Comments
 (0)