Skip to content

Commit 04807f8

Browse files
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 <josh.t.richards@gmail.com>
1 parent a1689cf commit 04807f8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/files_trashbin/lib/Trashbin.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ public static function move2trash($file_path, $ownerOnly = false) {
391391
'timestamp' => $timestamp,
392392
]
393393
);
394-
self::deleteTrashRow($user, $filename, $timestamp);
394+
// The metadata row belongs to the owner, even when another user initiated
395+
// the deletion.
396+
self::deleteTrashRow($owner, $filename, $timestamp);
395397
if ($trashStorage->file_exists($trashInternalPath)) {
396398
if ($trashStorage->is_dir($trashInternalPath)) {
397399
$trashStorage->rmdir($trashInternalPath);

0 commit comments

Comments
 (0)