Repository navigation
fix(client): report upload chunk parse errors on completion (fixes #7736) - #7759
Conversation
[Medium impact] The PR appears safe to merge. SummaryUpload responses now get a final parse pass when the request completes, so malformed chunks are logged even without a
All 12 upload tests passed. No actionable issues found. Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
# Conflicts: # packages/reflex-frontend/src/utils/helpers/upload.js # tests/units/reflex_base/client_upload.mjs
closes #7736
All Submissions:
Type of change
Changes To Core Features:
Description of Changes
Problem:
During file uploads, streamed responses lack a
Content-Lengthheader (Transfer-Encoding: chunked), meaningevent.lengthComputableisfalseandprogress === 1is never evaluated astrue. As a result, malformed chunks that failed parsing were silently ignored and never logged. In addition,xhr.onloadresolved the upload promise without a final pass over the complete response.Fix:
eventHandler(responseText, complete = false)inpackages/reflex-frontend/src/utils/helpers/upload.jsreplaces the progress-ratio check with a completion flag.xhr.onprogressno longer computes a progress ratio.xhr.onloadcallseventHandler(xhr.responseText, true)for a 2xx response, before the error-frame check from fix(upload): answer a failing upload handler with a 500 or an error frame #7808. So an error frame that only the final pass sees still fails the upload.Content-Lengthheader.tests/units/reflex_base/client_upload.mjs: a bad chunk is logged at load, a final chunk is completed after the last progress event, a response has no progress events, a progress ratio of 1 is not completion, an error frame is seen only at load, and an empty response. The existing error-status test covers the non-2xx case.packages/reflex-base/news/+upload-completion-errors.bugfix.md.