[Bug]: Permanently deleting a single trash bin item leaves its row in oc_files_trash
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza por apps/files_trashbin/lib/Trash/LegacyTrashBackend.php, especialmente por removeItem(), y sigue la ruta que se pasa a Trashbin::delete() comparándola con el ID almacenado por move2trash(). Reproduce el problema eliminando permanentemente un único elemento de nivel superior de la papelera y comprobando si permanece su fila en oc_files_trash. Se considera resuelto cuando la eliminación del elemento individual borra esa fila junto con el archivo; el issue propone una posible solución que hay que investigar.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug.
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level.
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
Permanently deleting a single top-level item from the trash bin (Files → Deleted files → "Delete permanently", or a WebDAV DELETE on remote.php/dav/trashbin/<user>/trash/<name>.d<timestamp>) removes the file and its versions from disk, but its row in oc_files_trash stays, with the file name and its original location. Nothing removes that row afterwards, except emptying the whole trash bin or deleting the user.
The trash bin listing is unaffected, as it comes from the disk. But the name of a file the user believes permanently deleted remains in the database, and in every database backup.
Cause. For a root item, getTrashPath() starts with a slash (/name.d1700000000, which is what isRootItem() relies on). LegacyTrashBackend::removeItem() strips the .d<timestamp> suffix but keeps the slash, and passes /name to Trashbin::delete():
The file is deleted fine (the extra slash is harmless in a path), then deleteTrashRow($user, '/name', $timestamp) looks for id = '/name', while move2trash() stored id = 'name', so the DELETE matches no row:
https://github.com/nextcloud/server/blob/0fba83d5205b4c74a17aef9511f6490d33eda6bb/apps/files_trashbin/lib/Trashbin.php#L782
https://github.com/nextcloud/server/blob/0fba83d5205b4c74a17aef9511f6490d33eda6bb/apps/files_trashbin/lib/Trashbin.php#L788-L795
Same code on master, stable35, stable31 and stable30.
Possible fix, tested on 35.0.3 with the steps below: the row is then removed.
Trashbin::delete(ltrim($path, '/'), $user->getUID(), $item->getDeletedTime());
Steps to reproduce
- Fresh Nextcloud 35.0.3 (official Docker image, SQLite), a user
alice - Upload
example.txtandother.txt, then delete both SELECT id, location, timestamp FROM oc_files_trash WHERE user = 'alice';→ two rows,example.txtandother.txt- Permanently delete
example.txtfrom the trash bin, e.g.curl -u alice -X DELETE http://localhost/remote.php/dav/trashbin/alice/trash/example.txt.d<timestamp>→204 - The trash bin now lists
other.txtonly, andfiles_trashbin/files/holdsother.txt.d<timestamp>only - Run the same
SELECTagain → both rows are still there
Control: emptying the whole trash bin (DELETE …/trashbin/alice/trash/) removes all rows, as expected. A file with versions behaves the same: its versions are removed from files_trashbin/versions/, its row stays.
Expected behavior
The row is removed together with the file, as when the whole trash bin is emptied.
Nextcloud Server version
35
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.5
Web server
Apache (supported)
Database engine version
SQLite
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"upgrade.disable-web": true,
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"localhost"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "sqlite3",
"version": "35.0.3.2",
"overwrite.cli.url": "http:\/\/localhost",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"dbname": "***REMOVED SENSITIVE VALUE***",
"installed": true
}
}
List of activated Apps
Default apps of a fresh 35.0.3 install, nothing added
Additional info
Also seen on PostgreSQL 18 with the same version.
- Lenguaje dominante
- PHP
- Estrellas
- 37.5k
- Forks
- 5.4k
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 639
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nextcloud/server
-
0. Needs triage 35-feedback bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
workflowengine: File entity reuses the node of the first "Tag assigned" event for all later events in the same processPosiblemente ocupada @lazerg la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Contacts import aborts with TypeError when vCards have no UID (TextImporter structure)Posiblemente ocupada @SebastianKrupinski la tomó hace 6 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nextcloud/server#66486 · 2 comentarios · 2 reacciones · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Unified search: screen reader hears "No matching results" on mobile even when there are resultsPosiblemente ocupada @lazerg la tomó hace 10 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
34-feedback needs info
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
nextcloud/server#66249 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de nextcloud/server
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Automattic/blocks-engine#6318 ·
Los mantenedores suelen responder en 1 día
-
[remove-resource] Delete Open Course Hub, Open Multicourse Hub, and Learn2 with GitSync skeletonsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Allow @ in the service nameAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100