Skip to content

Fix OpenPGP message decryption error caused by missing Content-Type header - #2170

Open
stefansieg wants to merge 1 commit into
the-djmaze:masterfrom
stefansieg:fix-mime-content-type
Open

stefansieg wants to merge 1 commit into
the-djmaze:masterfrom
stefansieg:fix-mime-content-type

Conversation

@stefansieg

Copy link
Copy Markdown

When decrypting an OpenPGP-encrypted message containing a MIME part without an explicit Content-Type header, SnappyMail displays the following error instead of the decrypted message:

Cannot read properties of undefined (reading 'value')

The decryption itself succeeds, but subsequent MIME processing fails because MimeToMessage() accesses type.value without checking whether the header exists.

This patch adds optional chaining to both affected Content-Type checks.

Successfully tested with:

  • Encrypted plain text messages
  • Encrypted HTML messages
  • Encrypted and signed messages

LLM-assisted code analysis. Tests were performed manually.

Prevent a TypeError when processing MIME parts without an explicit Content-Type header.

This branch has not been deployed

No deployments
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.

1 participant