Closed Bug 1484937 Opened 7 years ago Closed 4 years ago

Unable to open downloaded pdf files ("Cannot display PDF (<filename> cannot be opened)")

Categories

(Firefox for Android Graveyard :: Download Manager, defect, P2)

ARM
Android
defect

Tracking

(firefox61 wontfix, firefox62 wontfix, firefox63 wontfix, firefox64 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 affected)

RESOLVED INCOMPLETE
Tracking Status
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- wontfix
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- affected

People

(Reporter: mlobontiuroman, Unassigned)

References

()

Details

(Whiteboard: [geckoview:p2])

Attachments

(4 files)

Attached file logcat
Device: - Nexus 9 (Android 6.0.1); Build(s): - Nightly 63.0a1 (2018-08-20); - Beta 62.0b19; - Release 61.0.2; Steps to reproduce: 1. Navigate to http://1.usa.gov/deeXKM 2. Tap the notification displayed and verify that the PDF file can be displayed correctly. Expected result: The PDF is opened. Actual result: "Cannot display PDF (`filename` cannot be opened)" is displayed. Notes: Not reproducible on Nexus 5 mobile (Android 6.0.1).
Also reproducible on Xiaomi Mi Pad 2 (Android 5.1) Build: Beta 62.0b19
Can we find a regression range for this issue?
Hi Kevin, On Nexus 9 (Android 6.0.1) I cannot reproduce the issue anymore. On Xiaomi Mi Pad 2 (Android 5.1) I can still reproduce the issue, but, unfortunately, I cannot find a regression range. It looks like it was reproducible since 01.01.2016, and I cannot find any earlier builds. Thank you!
Flags: needinfo?(mirabela.lobontiu)
Hi Kevin, The device had PDF Reader for Android installed when I reported the issue. I installed Adobe Reader today, and now, the device opens the PDF file. Thanks!
Flags: needinfo?(mirabela.lobontiu)
Based on Comment 4, and 6, and on the fact that I cannot reproduce this issue, I will close this as WORKSFORME.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
@miralobontiu: Unfortunately this is still not quite fixed on 62.0.3 on Android 6, despite having Adobe Acrobat installed. Please reopen this bug or #1486233 where I posted more details. The following URL loads correctly in a PDF viewer on Firefox Desktop (Ubuntu), but not on Android: https://www.skybriefing.com/portal/delegate/dabs?today As an aside, I noticed that Firefox only offers download or open in Acrobat, despite having two other PDF viewers installed ("Document Viewer" from F-Droid and "PocketBook reader" from the Play Store) Thank you.
Hi Stephan, I could reproduce the issue with the URL provided by you on the latest Nightly (65.a01 2018-10-28), and on Firefox 63.0, with Nokia 6 (Android 7.1.1). So, I will reopen the issue. Thank you!
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
(In reply to stephan from comment #9) > As an aside, I noticed that Firefox only offers download or open in Acrobat, > despite having two other PDF viewers installed ("Document Viewer" from > F-Droid and "PocketBook reader" from the Play Store) If you mean the dialogue when/before the download starts - that only shows third party apps that can handle HTTP(S) URLs by themselves. My guess would therefore be that both "Document Viewer" and "PocketBook reader" only support opening local files, hence they aren't listed in the initial download app chooser dialogue.
This seems like a server-side issue. The linked PDF file doesn't have the correct content type, and therefor the PDF file is likely not handed over to the right application.
Does this happen in Chrome as well?
Flags: needinfo?(mirabela.lobontiu)
I can't reproduce the bug based on the URL in comment 0, but I can based on the URL in comment 9, and I can also reproduce using any of the "Agenda and Packet" links in the big table on https://www.cityofpaloalto.org/gov/depts/cou/council_agendas.asp . I'm on a Pixel 2 running Android 9 (December security update). Downloading the PDF does work when downloaded using Chrome on Android, and also works on Firefox Desktop. The file does pretty clearly appear to be recognized as a PDF; the PDF viewer opens briefly before the "Cannot display PDF (<filename> cannot be opened)" appears. I'll attach a series of 3 screenshots sowing the animation.
Summary: Unable to open downloaded pdf files. → Unable to open downloaded pdf files ("Cannot display PDF (<filename> cannot be opened)")
(this one is from a different click than the other two, since it's quick and hard to capture)
Hi Liz, As David said in Comment 14, it works as expected in Chrome. On the latest Nightly 66.0a1 (2018-12-12), it is still reproducible. Tested with Nokia 6 (Android 7.1.1).
Flags: needinfo?(mirabela.lobontiu)
Priority: -- → P2
Hi, I have the same problem with Xperia XZs Android 8.0.0 with Firefox 63.0.2 . I don't have the same problem with Chrome. I tested with multiple PDFs from different websites, but no one works correctly and I always get the same error message "unable to visualize pdf" from Drive PDF Viewer.

I have a feeling I am experiencing the same issue and the bugs (https://bugzilla.mozilla.org/show_bug.cgi?id=889105 and https://bugzilla.mozilla.org/show_bug.cgi?id=902971) are also possibly related. I think the path to the file being passed to the applications is being encoded correctly/as expected by the programs trying to open them. I have had the problem numerous times with Foxit Pro and put it down to it, but I have had it in a new calendar app I have just downloaded.

I have put a screen capture on youtube (https://youtu.be/l8lfRAGwXeg) showing the issue and the errors from the calendar app (Simple Calendar App).

To reproduce:

  1. Goto https://www.meetup.com/london-nodejs/events/257269047/
  2. Click on the Add to Calendar link
  3. Select ICal
  4. Open the downloaded ics file from either the notification or the popup
  5. Try to import the event
    Result. Import will error, either with a ENOTENT (from popup) or a ENOACCESS (from the notification)
Assignee: nobody → petru.lingurar
Status: REOPENED → ASSIGNED

The issue described in comment #9 is because the filename is not successfully extracted.
I see this first in HelperAppDialog.show [1] where aLauncher.suggestedFileName is dabs not dabs.pdf (although the mime type is correctly identified as application/pdf).
console.trace() does not want to go further and show the caller of this method so I don't know yet where this name is formed.

The file is persisted to disk with that filename (without an extension) and so Android cannot correctly infer the type of the file to know to open it with a pdf reader application.

[1] https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/mobile/android/components/HelperAppDialog.js#131

(In reply to Jack from comment #21)
I have created bug 1523976 for this since it seems like a separate issue.

(In reply to Petru-Mugurel Lingurar[:petru] from comment #23)

Indeed. Thanks Petru.

NI-ing Chris to assess the priority and find a more suitable owner since the issue happens because of an improperly deduced "mSuggestedFileName" in native code [1] and is reproducible also

  • on Focus (the file has .bin extension)
  • on Reference Browser (the filename is dabspdf (no dot before the extension); for other downloaded files the name seems to have the right structure)

// the filename for the pdf downloaded from https://www.skybriefing.com/portal/delegate/dabs?today should have been dabs.pdf

[1] https://searchfox.org/mozilla-central/source/uriloader/exthandler/nsExternalHelperAppService.cpp

Flags: needinfo?(cpeterson)
Assignee: petru.lingurar → nobody
Status: ASSIGNED → NEW

I can reproduce this bug in Focus+WebView (dabs.bin), Focus+GeckoView (dabspdf), the Reference Browser (dabspdf), and Fennec (dabs), but not Chrome Android or Firefox desktop. I wonder why this bug affects both Focus+WebView and GeckoView.

I'll send this bug to GeckoView triage for review. I'm guessing this is not a core Gecko bug because Firefox desktop is not affected.

Flags: needinfo?(cpeterson)
Whiteboard: [geckoview]
Status: NEW → RESOLVED
Closed: 7 years ago6 years ago
Resolution: --- → DUPLICATE

This can be reproduced on Desktop by setting PDF files to be automatically saved, which I think is also more similar to how downloads work on Android (although the code paths might still not be 100% identical).

Also note that on Desktop, the bug can be reproduced e.g. on Ubuntu, but not on Windows, because in addition to the file name (which ends up as dabs) we're also providing an extension to Windows's "Save as..." dialogue, which then fixes up the file name to include an extension by itself.

Although on second thought, while those problems are definitively related, I'm not sure how easily it would be to actually fix desktop and Android together in one go. So maybe this should be un-duped after all?

In that case, let's reopen this bug. Given that Focus+GeckoView and Fennec have different bad results ("dabspdf" vs "dabs" in comment 4), this bug might need to be fixed separately for GeckoView, Fennec, and desktop.

Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Whiteboard: [geckoview] → [geckoview:p2]
See Also: → 1527552
See Also: → 1544955
See Also: 1544955

Brilliant, thanks for sharing this info. This is all very interesting 🙂 mygroundbiz

We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: REOPENED → RESOLVED
Closed: 6 years ago4 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: