Closed Bug 1760025 Opened 3 years ago Closed 3 years ago

Cannot get attached email files via compose API.

Categories

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

defect

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
100 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: TbSync, Assigned: TbSync)

References

Details

Attachments

(3 files)

Summary: Cannot get attached email files. → Cannot get attached email files via compose API.

Please note that this happens with emails attached (.eml) and also with attachments from other emails attached. For example, drag&drop an attachment from an existing email to the compose window of a new email.

The reason for this is: The compose API (and also the cloudFile API, same bug there) expect the attachment to be a local file.

Would it be ok to create temporary local files when such things are being attached? This would happen here:
https://searchfox.org/comm-central/rev/695e6bdee2214b84351445001b29e269b3888e39/mail/components/compose/content/MsgComposeCommands.js#6922-6934

Instead of treating the special cases everywhere we currently use getFileFromURLSpec (which is what fails) to get the attachment file, I would handle these cases only once.

This is not only happening for entire messages being attached, but also for example single attachments from another email being dragged into the composer. We would automatically fix a bunch of similar issues, by enforcing (temp) local files.

Flags: needinfo?(mkmelin+mozilla)

Would it be ok to create temporary local files when such things are being attached?

I think that should be ok yes.

Flags: needinfo?(mkmelin+mozilla)
Assignee: nobody → john
Attachment #9268978 - Attachment description: WIP: Bug 1760025 - Use temporary files for attached messages and attachments from other messages. r=#thunderbird-reviewers → Bug 1760025 - Use temporary files for attached messages and attachments from other messages. r=mkmelin
Status: NEW → ASSIGNED
Target Milestone: --- → 100 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/fbef0eae0aa6
Use temporary files for attached messages and attachments from other messages. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

It's unfortunate that this code got copied:

+      let extAppLauncher = Cc["@mozilla.org/mime;1"].getService(
+        Ci.nsPIExternalAppLauncher
+      );

Clearly the nsPIExternalAppLauncher has nothing to do with mime, instead it should be done like here:
https://searchfox.org/comm-central/rev/d76107d796479ddf6c6c33057e63de932bb2e716/mail/extensions/openpgp/content/modules/persistentCrypto.jsm#151-152

You will ask why it works in the first place. Well, for some mysterious reason it seems to work by accident, since @mozilla.org/uriloader/external-helper-app-service;1 and @mozilla.org/mime;1 for some unexplicable reason have the same contract ID:
https://searchfox.org/mozilla-central/rev/8766f623040634d3d6c17150a6ec60e5fd30602e/docshell/build/components.conf#165-169

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/f1a4746ab4f8
Fix wrong usage of nsPIExternalAppLauncher. r=mkmelin

I returned to my latest public head when searching for that usage and forgot to do a pull, so I did not have my own patch included anymore. Thanks for noticing.

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/53fd4281c32d
Fix more wrong usage of nsPIExternalAppLauncher. r=mkmelin

Regressions: 1777351
Regressions: 1782173
Regressions: 1873023
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: