Merge pull request #12614 from appwrite/fix-deletefile-race-condition

Fix concurrent file deletion returning 500 instead of 404
This commit is contained in:
Damodar Lohani authored and GitHub committed 2026-06-24 08:50:16 +05:45
commit 6b2cb1817f
1 file changed
+5 -1
@@ -145,7 +145,11 @@ class Delete extends Action
}
if (!$deleted) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB');
$exists = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId));
if (!$exists->isEmpty()) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB');
}
throw new Exception(Exception::STORAGE_FILE_NOT_FOUND);
}
} else {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to delete file from device');