Bug:
When a file or folder is permanently deleted from the trashbin (through the GUI) the corresponding file/folder entry is not removed from the database trashbin table.
Cause:
In the static function apps/files_trashbin/lib/Trashbin.php delete($filename, $user, $timestamp = null) the filename parameter always seems to carry a leading '/' (at least I have not seen otherwise). The id of the item in trashbin the table however does not carry this leading '/'. Hence the item is not removed from the table.
(note that: filecache items are removed and the file/folder is actually removed from the storage/file-system)
Other observation:
In my case I'm developing an app that makes use of the Trashbin permanentDelete hook.
When the permanentDelete(array $params) method in that hook is called, the path entry in params has as value a path with a double forward slash in it. Eg. ['path' => '/files_trashbin/files//text.txt.d1731917455']
Both this observation and the bug cause seem to stem from the fact that the apps/files_trashbin/lib/Trash/TrashItem.php getTrashPath() function always returns the path with a leading / and that in the call chain no further processing is performed on this slash.
Steps to reproduce
Delete a file or folder from within the GUI
Navigate to trashbin and permanently delete the file or folder
Observe that the file/folder entry is not removed from the database trashbin table
Expected behavior
The file/folder entry is removed from the trashbin table.
Nextcloud Server version
30
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
⚠️ This issue respects the following points: ⚠️
Bug description
Bug: When a file or folder is permanently deleted from the trashbin (through the GUI) the corresponding file/folder entry is not removed from the database trashbin table.
Cause: In the static function
apps/files_trashbin/lib/Trashbin.php delete($filename, $user, $timestamp = null)
the filename parameter always seems to carry a leading '/' (at least I have not seen otherwise). The id of the item in trashbin the table however does not carry this leading '/'. Hence the item is not removed from the table.(note that: filecache items are removed and the file/folder is actually removed from the storage/file-system)
Other observation: In my case I'm developing an app that makes use of the Trashbin
permanentDelete
hook. When thepermanentDelete(array $params)
method in that hook is called, thepath
entry inparams
has as value a path with a double forward slash in it. Eg.['path' => '/files_trashbin/files//text.txt.d1731917455']
Both this observation and the bug cause seem to stem from the fact that the
apps/files_trashbin/lib/Trash/TrashItem.php getTrashPath()
function always returns the path with a leading/
and that in the call chain no further processing is performed on this slash.Steps to reproduce
Expected behavior
The file/folder entry is removed from the trashbin table.
Nextcloud Server version
30
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
Environment: . Nextcloud docker image nextcloud:30.0.1 . MariaDB docker image mariadb:10.9