From 04807f8b4b07b91fe546576b419939cdfed617cb Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 7 Aug 2026 22:47:44 -0400 Subject: [PATCH] fix(files_trashbin): remove failed move metadata for file owner When moving a shared file to the trash fails after its metadata row has been inserted, the failure-cleanup path calls `deleteTrashRow()` with the deleting user. The row was inserted for the file owner, so this leaves orphaned `files_trash` metadata whenever the owner and deleting user differ. Doesn't impact success path; just the rollback path. This change uses `$owner` for the cleanup call, ensuring the inserted metadata row is removed. Signed-off-by: Josh --- apps/files_trashbin/lib/Trashbin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 41301c84f41d6..1614ba2a9e71a 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -391,7 +391,9 @@ public static function move2trash($file_path, $ownerOnly = false) { 'timestamp' => $timestamp, ] ); - self::deleteTrashRow($user, $filename, $timestamp); + // The metadata row belongs to the owner, even when another user initiated + // the deletion. + self::deleteTrashRow($owner, $filename, $timestamp); if ($trashStorage->file_exists($trashInternalPath)) { if ($trashStorage->is_dir($trashInternalPath)) { $trashStorage->rmdir($trashInternalPath);