firefox-ios icon indicating copy to clipboard operation
firefox-ios copied to clipboard

Download pdf corrupts file

Open kr4z33 opened this issue 2 years ago • 3 comments

Steps to reproduce

Share previewed pdf with another iOS app

Expected behavior

Other app gets pdf and opens it successfully

Actual behavior

Other app reports corrupted pdf, 16kb file size. Same result in two different pdf apps receiving the file (Xodo & pdf Expert)

Device & build information

  • Device: iPad Pro
  • Build version: ?

Notes

This workflow is successful with the safari browser

┆Issue is synchronized with this Jira Task

kr4z33 avatar Jul 18 '22 20:07 kr4z33

I have the same issue! When I want to share the pdf with other app or print it, I always get a 182 bytes file and there is nothing in the file. But when I use other app like safari or edge, everything is ok. My device is ipad air5 and the version of firefox is 104.2.

wzf03 avatar Sep 13 '22 08:09 wzf03

However, when I try to share the pdf in http://www.pdf995.com/samples/pdf.pdf, it works. I thought this bug may happen in some websites which dynamically load the pdf.

wzf03 avatar Sep 13 '22 08:09 wzf03

Most likely you are trying to download a file from a website which requires a login or cookies. In that case, it is likely a duplicate of #9010.

Lekensteyn avatar Sep 21 '22 16:09 Lekensteyn

➤ Nishant Bhasin commented:

Mini-Investigation Notes

Instead of redownloading the PDF, look into why the[ Tab’s temporary document |https://github.com/mozilla-mobile/firefox-ios/blob/main/Client/TabManagement/Tab.swift#L303]contains and share the data with the respective application.

  1. Make sure the temporary document ( https://github.com/mozilla-mobile/firefox-ios/blob/main/Client/Frontend/Browser/TemporaryDocument.swift )t is not nil
  2. If the temporary document ( https://github.com/mozilla-mobile/firefox-ios/blob/main/Client/Frontend/Browser/TemporaryDocument.swift ) in tab is not nil then check what and how items are being shared in presentShareSheet ( https://github.com/mozilla-mobile/firefox-ios/blob/main/Client/Frontend/Browser/BrowserViewController.swift#L1533 )

This is just one approach as we can’t really re-download the pdf file but should share what we already have in form of temporary document.

data-sync-user avatar Jul 25 '23 02:07 data-sync-user

Maybe related to https://github.com/mozilla-mobile/firefox-ios/issues/14053.

clemlesne avatar Oct 29 '23 16:10 clemlesne