@@ -41,8 +41,10 @@ const verifySignature = async (
4141 if ( parts . length < 3 ) {
4242 return { subdata : data , verificationStatus : VERIFICATION_STATUS . NOT_SIGNED , signatures : [ ] } ;
4343 }
44- const { attachments : [ sigAttachment ] = [ ] } = await parseMail ( parts [ 2 ] . trim ( ) ) ;
45- const { contentType : sigAttachmentContentType = '' , content : sigAttachmentContent = new Uint8Array ( ) } = sigAttachment ?? { } ;
44+ const { attachments : [ sigAttachment ] } = await parseMail ( parts [ 2 ] . trim ( ) ) ;
45+ const { contentType : sigAttachmentContentType = '' , content : sigAttachmentContent = new Uint8Array ( ) } = (
46+ sigAttachment as Attachment | undefined /** explicit typing needed due to TS inference limitation with array destructuring */
47+ ) ?? { } ;
4648 if ( sigAttachmentContentType . toLowerCase ( ) !== 'application/pgp-signature' ) {
4749 return { subdata : data , verificationStatus : VERIFICATION_STATUS . NOT_SIGNED , signatures : [ ] } ;
4850 }
@@ -93,7 +95,7 @@ const parse = async (
9395 signatures : OpenPGPSignature [ ] = [ ]
9496) : Promise < ProcessMIMEResult > => {
9597 // cf. https://github.com/autocrypt/memoryhole subject can be in the MIME headers
96- const { attachments : parsedAttachments = [ ] , body : { text = '' , html = '' } , subject : mimeSubject = '' } = await parseMail ( mailContent ) ;
98+ const { attachments : parsedAttachments , body : { text, html } , subject : mimeSubject = '' } = await parseMail ( mailContent ) ;
9799
98100 // normalise attachments and look for encrypted subject
99101 let encryptedSubjectHeader ;
0 commit comments