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) <noreply@anthropic.com>
This commit is contained in:
Damodar LohaniandClaude Opus 4.8 committed 2026-06-02 02:24:30 +00:00
1 parent db59f5d338
commit 47e2ccd96a
1 file changed
+2
@@ -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