Skip to content

Commit f707f6f

Browse files
committed
fix incorrect logic for obtaining message attachments
1 parent ae3e7bc commit f707f6f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

extension/js/service_worker/bg-handlers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ export class BgHandlers {
168168
): Promise<Bm.Res.ThunderbirdGetDownloadableAttachment> => {
169169
const processableAttachments: Bm.Res.ThunderbirdGetDownloadableAttachment = [];
170170
const [tab] = await messenger.mailTabs.query({ active: true, currentWindow: true });
171-
if (tab.id) {
171+
const message = await messenger.messageDisplay.getDisplayedMessage(tab.id);
172+
if (tab.id && message?.id) {
172173
const fcAttachments: Attachment[] = [];
173174
// convert Thunderbird Attachments to FlowCrypt recognizable Attachments
174175
for (const tbAttachment of r.attachments) {
175-
const rawAttachment = await messenger.messages.getAttachmentFile(tab.id, tbAttachment.partName);
176+
const rawAttachment = await messenger.messages.getAttachmentFile(message.id, tbAttachment.partName);
176177
fcAttachments.push(
177178
new Attachment({
178179
data: new Uint8Array(await rawAttachment.arrayBuffer()),

0 commit comments

Comments
 (0)