Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prevent crash when decoding binary multipart request bodies#9680

Open
rishika0212 wants to merge 4 commits intoflutter:masterfrom
rishika0212:fix-multipart-binary-crash
Open

Prevent crash when decoding binary multipart request bodies#9680
rishika0212 wants to merge 4 commits intoflutter:masterfrom
rishika0212:fix-multipart-binary-crash

Conversation

@rishika0212
Copy link

Fixes #9626

DevTools previously attempted to decode all request and response
bodies using utf8.decode(), which throws a FormatException when
binary data (e.g., multipart file uploads such as PDFs) is encountered.

This change:

• Adds defensive UTF-8 decoding for UI display
• Caches a descriptive placeholder for non-text binary bodies
• Preserves raw byte buffers for accurate HAR export
• Ensures binary bodies are Base64 encoded in HAR output
with the required encoding: "base64" field (HAR 1.2 spec)

Valid UTF-8 responses are unaffected.

This prevents the Network screen from hanging when viewing
multipart requests containing binary payloads while maintaining
correct export behavior.

@rishika0212 rishika0212 requested review from a team, bkonyi and kenzieschmoll as code owners March 1, 2026 19:49
Copy link
Contributor

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks great; thanks much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DevTools has trouble reading multipart requests

2 participants