nextcloud / nextcloud/groupquota
occ groupquota:list with a group which has been deleted results in an exception
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 35
- Forks
- 10
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
I'm fairly certain that this is because I have a group which I have since set a group quota for and then deleted.
root@cloud:~# ./occ groupquota:list
/usr/share/nginx/nextcloud ~
PHP Warning: JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled. in Unknown on line 0
group |free |used |total
----------------------------------------------|-----------------------------------------------|-----------------------------------------------|-----------------------------------------------
Bollinger |2198996259191 |26996361 |2199023255552
Brown |2199023255552 |0 |2199023255552
Dumbass |1311362628688 |887660626864 |2199023255552
An unhandled exception has been thrown:
TypeError: OCA\GroupQuota\Quota\UsedSpaceCalculator::getUsedSpaceByGroup(): Argument #1 ($group) must be of type OCP\IGroup, null given, called in /usr/share/nginx/nextcloud/apps/groupquota/lib/Command/QuotaList.php on line 78 and defined in /usr/share/nginx/nextcloud/apps/groupquota/lib/Quota/UsedSpaceCalculator.php:42
Stack trace:
#0 /usr/share/nginx/nextcloud/apps/groupquota/lib/Command/QuotaList.php(78): OCA\GroupQuota\Quota\UsedSpaceCalculator->getUsedSpaceByGroup()
#1 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OCA\GroupQuota\Command\QuotaList->execute()
#2 /usr/share/nginx/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run()
#3 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(1078): OC\Core\Command\Base->run()
#4 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#5 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#6 /usr/share/nginx/nextcloud/lib/private/Console/Application.php(183): Symfony\Component\Console\Application->run()
#7 /usr/share/nginx/nextcloud/console.php(87): OC\Console\Application->run()
#8 /usr/share/nginx/nextcloud/occ(33): require_once('...')
#9 {main}~
I'm pretty sure, but not postive that the way to reproduce this is:
- Make a group
- set a quota on that group
- delete said group
There might also be some crufty values in the database as well since I was an early adopter of the plugin. However, in either case, there needs to be a fall back if getting a group returns None.. IE, that group no longer exists.
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 with apps/groupquota/lib/Command/QuotaList.php at line 78 and apps/groupquota/lib/Quota/UsedSpaceCalculator.php at line 42, then reproduce the issue with occ groupquota:list after deleting a group that has a quota. Done means the command handles the deleted group without throwing the shown TypeError and still reports the remaining quota entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100