nextcloud / groupfolders

πŸ“πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Admin-configured folders shared by everyone in a group. https://github.com/nextcloud-releases/groupfolders
https://apps.nextcloud.com/apps/groupfolders
291 stars 87 forks source link

Deleting files in groupfolder using occ files:delete -fn throws an unhandled exception #3413

Open jiri-jenicek opened 1 week ago

jiri-jenicek commented 1 week ago

How to use GitHub

Steps to reproduce

  1. Group folders and Deleted files apps installed and active.
  2. File, emtpy directory or directory with some content is present in groupfolder.
  3. Run in server console 'occ files:delete -fn "user/files/gfolder/somedir"'

Expected behaviour

'somedir' is silently removed.

Actual behaviour

When 'somedir' exists and the 'occ files:delete -fn "user/files/gfolder/somedir"' is run in server console for the first time, it will throw the exception (with occ return code 1):

An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php:215
Stack trace:
#0 /var/www/html/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php(85): OCA\GroupFolders\Trash\TrashBackend->moveToTrash()
#1 /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php(168): OCA\Files_Trashbin\Trash\TrashManager->moveToTrash()
#2 /var/www/html/nextcloud/apps/files_trashbin/lib/Storage.php(90): OCA\Files_Trashbin\Storage->doDelete()
#3 /var/www/html/nextcloud/lib/private/Files/View.php(1136): OCA\Files_Trashbin\Storage->rmdir()
#4 /var/www/html/nextcloud/lib/private/Files/View.php(286): OC\Files\View->basicOperation()
#5 /var/www/html/nextcloud/lib/private/Files/Node/Folder.php(374): OC\Files\View->rmdir()
#6 /var/www/html/nextcloud/apps/files/lib/Command/Delete.php(91): OC\Files\Node\Folder->delete()
#7 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OCA\Files\Command\Delete->execute()
#8 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run()
#9 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#10 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#11 /var/www/html/nextcloud/lib/private/Console/Application.php(183): Symfony\Component\Console\Application->run()
#12 /var/www/html/nextcloud/console.php(87): OC\Console\Application->run()
#13 /var/www/html/nextcloud/occ(11): require_once('...')

The 'somedir' is deleted on filesystem, but still present in nextcloud web interface, leading to inconsistent state. When the command is run for the second time, it does not throw the exception, and removes 'somedir' from web interface (return code 0).

Deleting using 'occ files:delete -fn "whatever"' in regular folder (not a group folder) works as expected.

Server configuration

Operating system: Rocky linux 9.4

Web server: Apache/2.4.57

Database: mysql 10.11.6

PHP version: 8.2.25

Nextcloud version: 30.0.2

Group folders version: 18.0.4

Updated from an older Nextcloud/ownCloud or fresh install: Updated

Where did you install Nextcloud from: nextcloud.com archive

Are you using external storage, if yes which one: local/s3/smb/sftp/... no

Are you using encryption: yes/no no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/Saml/... no

Client configuration

Browser: Firefox 132.0.1

Operating system: Windows 10 x64

Logs

Web server error log

No errors in ssl_error_log and error_log

Web server error log

Nextcloud log (data/nextcloud.log)

No error in nextcloud.log ('loglevel' => 1)

Nextcloud log