From 47e2ccd96a6b7629d8dd62ff37387a74fb4eed8d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 2 Jun 2026 02:24:30 +0000 Subject: [PATCH] fix: reset queued event on non-final chunk in createFile On chunked uploads, the createFile route registers a templated event label `buckets.[bucketId].files.[fileId].create` during init. On an intermediate (non-final) chunk the request returns 201 but the event params are never set, so App::shutdown() calls Event::generateEvents() with an unpopulated [bucketId] template and throws "[bucketId] is missing from the params". Reset the queued event in the non-final-chunk branch so no templated event is generated until the upload completes, matching the reset() already used by other early-exit paths in the same closure. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Platform/Modules/Storage/Http/Buckets/Files/Create.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 348b19c039..69b27af25c 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -497,6 +497,8 @@ class Create extends Action ->setParam('bucketId', $bucket->getId()) ->setParam('fileId', $file->getId()) ->setContext('bucket', $bucket); + } else { + $queueForEvents->reset(); } $metadata = null; // was causing leaks as it was passed by reference