files:transfer-ownership fails with "not enough free space" when the target quota is unlimited
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Bug description
occ files:transfer-ownership aborts with Target user does not have enough free space available. when the destination user has unlimited quota on an instance using object storage as primary storage — it fails precisely because the target has no limit.
Cause
OwnershipTransferService::analyse():
$freeSpace = $view->free_space($destinationUid . '/files/');
if ($size > $freeSpace && $freeSpace !== FileInfo::SPACE_UNKNOWN) {
free_space() returns negative sentinels, but the guard exempts only SPACE_UNKNOWN (-2). For a quota-less user, Quota::free_space() passes through to ObjectStoreStorage::free_space(), which returns SPACE_UNLIMITED (-3) when no totalSizeLimit is set. $size > -3 is true for any non-empty source, so it throws. SPACE_NOT_COMPUTED (-1) has the same flaw.
Not reachable on local primary storage, where an unlimited-quota user gets real disk free space — which is probably why it hasn't surfaced before.
Steps to reproduce
- Object store as primary storage, no
totalSizeLimit. - Destination user quota
none. occ files:transfer-ownership --path="<non-empty folder>" <source> <destination>
Workaround
Set a finite quota on the destination, transfer, set it back to none.
Version
34.0.3, and present on master @ 22bd34a.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/files/lib/Service/OwnershipTransferService.php, especially OwnershipTransferService::analyse() around the free-space check, and trace the quota values described in the issue. Reproduce with an object store as primary storage and an unlimited destination quota using occ files:transfer-ownership; done means a non-empty transfer no longer aborts because the destination quota is unlimited or not computable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100