Skip to content

Commit cbc1687

Browse files
author
Ioan Moldovan
authored
#5913 Add encrypted attachment to password protected message (#5919)
* feat: add encrypted attachment to password protected message * feat: added ui test * fix: ui test * feat: add attachment in encrypt.asc * fix: send message strategy * Revert "fix: send message strategy" This reverts commit ff49e47.
1 parent 63269ad commit cbc1687

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

extension/chrome/elements/compose-modules/formatters/encrypted-mail-msg-formatter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ export class EncryptedMsgMailFormatter extends BaseMailFormatter {
181181
{ msgUrl, externalId }: { msgUrl: string; externalId?: string },
182182
signingPrv?: Key
183183
) => {
184-
// encoded as: PGP/MIME-like structure but with attachments as external files due to email size limit (encrypted for pubkeys only)
184+
// encoded as: PGP/MIME-like structure
185185
const msgBody = this.richtext ? { 'text/plain': newMsg.plaintext, 'text/html': newMsg.plainhtml } : { 'text/plain': newMsg.plaintext };
186+
const attachments = await this.view.attachmentsModule.attachment.collectEncryptAttachments(pubs);
186187
// eslint-disable-next-line @typescript-eslint/naming-convention
187-
const pgpMimeNoAttachments = await Mime.encode(msgBody, { Subject: newMsg.subject }, []); // no attachments, attached to email separately
188+
const pgpMimeNoAttachments = await Mime.encode(msgBody, { Subject: newMsg.subject }, attachments);
188189
const { data: pubEncryptedNoAttachments } = await this.encryptDataArmor(Buf.fromUtfStr(pgpMimeNoAttachments), undefined, pubs, signingPrv); // encrypted only for pubs
189190
const emailIntroAndLinkBody = await this.formatPwdEncryptedMsgBodyLink(msgUrl);
190191
return await SendableMsg.createPwdMsg(

test/source/mock/google/strategies/send-message-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const checkForAbsenceofBase64InAttachments = async (attachments: Attachment[]) =
3030
if (typeof encoding !== 'string') {
3131
throw new HttpClientErr(`Error: Content-Transfer-Encoding isn't present in one of the attachments`);
3232
}
33-
if (!['7bit', 'quoted-printable'].includes(encoding)) {
33+
if (!['7bit', 'quoted-printable', 'base64'].includes(encoding)) {
3434
throw new HttpClientErr(`Error: Unexpected Content-Transfer-Encoding: ${encoding}`);
3535
}
3636
}

0 commit comments

Comments
 (0)