Closed Bug 1698270 Opened 3 years ago Closed 3 years ago

messages.getAttachmentFile needs to inform the File object of the content type

Categories

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

defect

Tracking

(thunderbird_esr78 unaffected)

RESOLVED FIXED
88 Branch
Tracking Status
thunderbird_esr78 --- unaffected

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

I've been trying out bug 1550960 on latest central, and I hit an issue when loading images:

        let file = await browser.messages.getAttachmentFile(
          id,
          attachment.partName
        );
        let reader = new FileReader();
        attachment.url = await new Promise((resolve) => {
          reader.onload = (e) => {
            resolve(e.target.result);
          };
          reader.readAsDataURL(file);
        });

In this case, the data url returned always starts with data:application/octet-stream;base64,....

If I try and change the content type in the url, then it still fails to load.

The solution is to tell the created File object about the content type, so that it can get everything right.

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/comm-central/rev/a9ec53ce2ad2
The File object needs to know the content type for correct handling of attachment files in messages.getAttachmentFile WebExtension API. r=john.bieling

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: