Skip to content

fix: prevent TransactionTooLargeException when attaching a file while replying to a message with a large HTML quote#11263

Open
mvanhorn wants to merge 1 commit into
thunderbird:mainfrom
mvanhorn:fix/9425-reply-attach-crash-large-html-quote
Open

fix: prevent TransactionTooLargeException when attaching a file while replying to a message with a large HTML quote#11263
mvanhorn wants to merge 1 commit into
thunderbird:mainfrom
mvanhorn:fix/9425-reply-attach-crash-large-html-quote

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Contribution Summary

Linked Issue/Ticket: Fixes #9425

Description

In QuotedMessagePresenter.onSaveInstanceState the offending line is outState.putSerializable(STATE_KEY_HTML_QUOTE, quotedHtmlContent). Guard this put by the character length of the quoted content (quotedHtmlContent.getQuotedContent()): only persist the HTML quote into the saved-state Bundle when it is below a safe threshold well under the Binder limit (e.g. a ~256 KB / ~262144-char cap defined as a constant), and skip the put when it is larger. This eliminates the oversized parcel and therefore the crash. To keep the size check unit-testable without standing up the full presenter (whose constructor pulls DI singletons and a MessageCompose/view), extract the decision into a small pure helper (e.g. a package-visible static shouldPersistQuotedHtml(InsertableHtmlContent, int maxChars) / size computation) that onSaveInstanceState calls. onRestoreInstanceState already null-checks quotedHtmlContent, so when the quote was skipped the composer degrades gracefully rather than crashing: the user's typed text (saved separately by the EditText) is preserved, and only the rarely-hit "process killed while the picker is open, then recreated" path loses the re-displayable quote - an acceptable trade versus a guaranteed crash on every attach. MessageCompose.java is the caller of onSaveInstanceState but requires no change, so it is intentionally excluded from the scope list.

Screen Shots

N/A - no UI change; the fix guards saved-state serialization of the quoted-HTML in QuotedMessagePresenter.

AI Disclosure

Select one of the following (mandatory)

  • This contribution does not include any changes created or assisted by AI.
  • This contribution includes changes assisted by AI.
  • This contribution includes changes created by AI.

Contribution Checklist

  • I have read and affirm that my contribution adheres to Mozilla's Community Participation Guidelines
  • This contribution is in Kotlin where possible
  • This contribution does not use merge commits
  • This contribution adheres to the existing codestyle (spotless)
  • This contribution does not break existing unit tests
  • This contribution includes tests for any new functionality, and maintains tests for any updated functionality
  • This contribution adheres to our Engineering process (RFC/Technical Design/ADR)
  • This PR has a descriptive title and body that accurately outlines all changes made, and references the issue it fixes (Fixes Error when attaching file or image when we reply #9425).

… replying to a message with a large HTML quote
@github-actions

Copy link
Copy Markdown
Contributor

Missing report label. Set exactly one of: report: include, report: exclude OR report: highlight.

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.

Error when attaching file or image when we reply

2 participants