tmail-flutter icon indicating copy to clipboard operation
tmail-flutter copied to clipboard

View PDF should preserve filename

Open chibenwa opened this issue 1 year ago • 2 comments

Description

image

When I click on the attachment to open it in a new tab, and save it:

image

The filename is not preserved and I have a super weird UUID instead.

As a user this is annoying, I want the filename to be preserved!

chibenwa avatar Mar 19 '24 14:03 chibenwa

Due to Chrome's limitation, current approach cannot achieve this. More info is discussed in the below threads:

  • https://stackoverflow.com/questions/50573429/url-createobjecturlblob-how-do-i-give-a-meaningful-filename-to-a-dynamicall
  • https://stackoverflow.com/questions/44061354/set-the-default-save-as-name-for-a-an-embed-or-iframe-that-uses-a-blob
  • https://stackoverflow.com/questions/53548182/can-i-set-the-filename-of-a-pdf-object-displayed-in-chrome
  • https://stackoverflow.com/questions/41947735/custom-name-for-blob-url

Changing solution direction to find a js library to display pdf, and try to handle download job (possibly print job also) deliberately

tddang-linagora avatar Mar 20 '24 07:03 tddang-linagora

Decision

Different libraries was chosen for each browser below:

  • Firefox: None. It can work by Dart code only.
  • Chrome: PDF.js
  • Safari: PDFObject (Due to PDF.js bug on Safari - https://github.com/mozilla/pdf.js/issues/17249)

tddang-linagora avatar Mar 21 '24 10:03 tddang-linagora

Use other approach. #2780

hoangdat avatar May 21 '24 23:05 hoangdat