Closed Bug 1852746 Opened 1 year ago Closed 5 months ago

listAttachments() is empty for encrypted messages

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

Thunderbird 115
defect

Tracking

(thunderbird128 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
thunderbird128 --- fixed

People

(Reporter: tim.heithecker, Assigned: TbSync)

References

Details

(Whiteboard: [PrioESR128])

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0

Steps to reproduce:

Execute messages.listAttachments with the id of an encrypted message that has attachments.

E.g. as in the “background.js” file of the attached add-on:

messenger.messageDisplay.onMessageDisplayed.addListener((tab, message) => {
  messenger.messages.listAttachments(message.id).then(console.debug)
})

Actual results:

The returned array is empty. It does not contain the attachments.
I also tried version 118.0b3 and got the same results.

Expected results:

The returned array should contain the attachments. Just like it worked in older versions and still works for unencrypted messages.

I am seeing this problem too, but with unencrypted emails.

It seems that emails where a PDF file is attached with the Content-Type: application/octet-stream are not properly listed in the listAttachments function, even though they are listed in the attachment pane when opening the email.

An example email where this occurs (with private information removed) is attached.

Attached file example.eml
Attachment #9381433 - Attachment is obsolete: true

I will work on this within the next few weeks. The groundwork has been done. We need to fix Bug 1882832 and then this can be implemented.

Depends on: 1882832
Whiteboard: [PrioESR128]

This is a regression from switching to the MimeTreeEmitter. The old
implementation always tried to decrpypt the message for attachment
extraction. The new implementation did not, which is fixed by this patch.

This also adds an extended test to actually check listAttachments() on
an encrypted message (including nested messages).

Note: getRaw() and getFull() have an option to work on the original or
on the decrypted message. This patch does not add the same option for
listAttachments(). We currently do not handle encrypted parts as
"attachments" (this is why listAttachments() did not return the
raw encrypted part before this patch) and there has not been a request
to access the raw enrcrypted part. We may come back to this at a later time.

The changes in utils.js are fixing an incomplete type check. Only
boolean, number and string variables where type checked,
but not date for example. This patch also adds some more verbose
output to make it easier to track errors.

Assignee: nobody → john
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → 129 Branch

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/44bca50b447a
Fix listAttachments() being empty for encrypted messages. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED

Comment on attachment 9406249 [details]
Bug 1852746 - Fix listAttachments() being empty for encrypted messages. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #): Regression from switching to a different parser method
User impact if declined: listAttachments() does not return attachments of encrypted messages
Testing completed (on c-c, etc.): a few days (missed landing on 128 by a few days)
Risk to taking this patch (and alternatives if risky): Low

Attachment #9406249 - Flags: approval-comm-beta?

Comment on attachment 9406249 [details]
Bug 1852746 - Fix listAttachments() being empty for encrypted messages. r=#thunderbird-reviewers

[Triage Comment]
Approved for beta

Attachment #9406249 - Flags: approval-comm-beta? → approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: