Skip to content

Commit

Permalink
Improve encrypted message detection for multipart email
Browse files Browse the repository at this point in the history
  • Loading branch information
martgil committed May 21, 2024
1 parent d4b2b95 commit 9278181
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extension/js/common/api/email-provider/gmail/gmail-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ export class GmailParser {
const parts = payload.parts!; // eslint-disable-line @typescript-eslint/no-non-null-assertion
// are we dealing with a PGP/MIME encrypted message?
const pgpEncrypted = Boolean(
parts.length === 2 && contentType?.value?.startsWith('multipart/encrypted;') && contentType.value.includes('protocol="application/pgp-encrypted"')
parts.length === 2 &&
contentType?.value?.startsWith('multipart/encrypted') &&
(contentType.value.includes('protocol="application/pgp-encrypted"') || parts[0]?.mimeType?.includes('application/pgp-encrypted'))
);
for (const [i, part] of parts.entries()) {
GmailParser.findAttachments(part, internalMsgId, internalResults, {
Expand Down

0 comments on commit 9278181

Please sign in to comment.