Closed Bug 1978213 Opened 9 months ago Closed 5 months ago

pdfs opened in the internal viewer via browser.messages.openAttachment don't have a name when downloaded

Categories

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

defect

Tracking

(thunderbird_esr140 wontfix)

RESOLVED FIXED
147 Branch
Tracking Status
thunderbird_esr140 --- wontfix

People

(Reporter: standard8, Assigned: mkmelin)

References

Details

Attachments

(2 files)

STR (TB 140.0.1):

  • In your add-on, have a line such as:
browser.messages.openAttachment(id, partName, tabId);
  • Have Thunderbird's defaults to open pdfs in the internal viewer.
  • Open a pdf attachment via the add-on so that it calls the openAttachment, and opens in the internal viewer.
  • Click the save button

Actual Results

A save dialog appears with the document name as "document.pdf"

Expected Results

The save dialog should have the name of the attachment from the email.

If I open the attachment using Thunderbird's mail reader, then the save button works correctly. The imap://... url has an additional &filename=<name>.pdf in the URL, which I presume is what causes it work.

Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/0f00c8246bfc
Add filename to attachment url so that pdfs opened in the internal viewer via browser.messages.openAttachment have a name when downloaded. r=john.bieling

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

Drive-by comment: Does the fix

-            url: getMsgPartUrl(msgHdr, partName),
+            url:
+              getMsgPartUrl(msgHdr, partName) +
+              `&filename=${attachmentPart.name}`,

work for "exotic" filenames? Like filenames with spaces, non-ASCII, etc.?

Good catch, that does indeed need to be encoded!

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: --- → 147 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/3fe1f53a722d
encode filenames for browser.messages.openAttachment. r=john.bieling

Status: REOPENED → RESOLVED
Closed: 5 months ago5 months ago
Resolution: --- → FIXED

Comment on attachment 9510007 [details]
Bug 1978213 - Add filename to attachment url so that pdfs opened in the internal viewer via browser.messages.openAttachment have a name when downloaded. r=john.bieling

Uplift Approval Request

  • Please state case for uplift consideration and ensure bug severity is set: Polish
    (both patches)
  • User impact if declined: Real filename can't be used
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Daily?: Yes
  • Has the fix been verified in Beta?: No
  • Needs manual test from QA?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It's a small confined change.
  • Does the fix cause any migrations to be skipped?: No
  • String changes made/needed:
Attachment #9510007 - Flags: approval-comm-beta?

Comment on attachment 9510007 [details]
Bug 1978213 - Add filename to attachment url so that pdfs opened in the internal viewer via browser.messages.openAttachment have a name when downloaded. r=john.bieling

[Triage Comment]
I don't think this qualifies for uplift unfortunately. Please demonstrate that it is a high-impact issue that qualifies according to these guidelines: https://developer.thunderbird.net/releases/uplifting-fixes

Attachment #9510007 - 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

Created:
Updated:
Size: