Open Bug 1884249 Opened 2 years ago Updated 2 years ago

Trying to view a saved .pdf files reports that the file is not found

Categories

(GeckoView :: PDF Viewer, defect)

Firefox 123
All
Android
defect

Tracking

(firefox123 ?, firefox124 ?, firefox125 affected)

Tracking Status
firefox123 --- ?
firefox124 --- ?
firefox125 --- affected

People

(Reporter: seburo3, Unassigned)

References

Details

Steps to reproduce

  1. Navigate to ntv.de
  2. Select a news article
  3. Open the Firefox for Android menu and select the share icon
  4. Select Save as PDF
  5. When the file has downloaded, select the option to view it in Firefox

Expected behavior

The file is viewed in Firefox for Android

Actual behavior

The file is not found at an address of content://org.mozilla.firefox.feature.downloads.fileprovider/Download/Download/(filename).pdf

Device information

  • Firefox version: 123
  • Android device model: Sony ZX1 Compact & Moto G30
  • Android OS version: LineageOS 20 & Android 13

Any additional information?

SUMO Forum question at https://support.mozilla.org/en-US/questions/1439690

Summary: Viewing saved .pdf → Viewing saved .pdf files
Component: General → PDF Viewer
Product: Fenix → GeckoView
Summary: Viewing saved .pdf files → Trying to view a saved .pdf files reports that the file is not found

The severity field is not set for this bug.
:calu, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(calu)

Can reproduce this issue of File Not Found on ntv.de. Even when it is able to download, the pdf only shows the ntv logo and not the full article.

Example file not found link:
content://org.mozilla.fenix.debug.feature.downloads.fileprovider/Download/Download/Keine%20Streiks%20mehr%3A%20GDL%20verk%C3%BCndet%20Tarifeinigung%20mit%20der%20Bahn%20-%20n-tv.de.pdf

When translated to English, the link to download still does not work.
Example file not found link (translated to English):
content://org.mozilla.fenix.debug.feature.downloads.fileprovider/Download/Download/No%20more%20strikes%3A%20GDL%20announces%20tariff%20inclination%20by%20train%20-%20n-tv.de.pdf

Olivia, any idea on why this might be happening?

Flags: needinfo?(calu) → needinfo?(ohall)

More background on this issue, since it is a bit of a compound bug, there are really two layers to this flow and a bug can appear in either layer:

  1. Make a PDF using the "Save as PDF" Engine
  2. View that PDF in the viewer
    • Has some similarities to bug 1875087. Linking since it is a very adjacent bug, but I don't exactly think they are directly related and mostly to rule it out.

I saw what I think are two errors as well:

File Not Found Error

I think this error is on the layer around giving the data to the PDF viewer.

I reproduced file not found by selecting an article with +++ in the live ticker title on https://www.n-tv.de/. This tries to generate a download with +++++ in the title, which is maybe an invalid character somewhere in the flow. Could also possibly be a filename character limit somewhere?

Let me know if you saw "File not found" outside of a special character in the download name.

03-26 10:24:29.989 24518 24544 E ContentInputStream: Cannot read the uri: content://org.mozilla.fenix.feature.downloads.fileprovider/Download/Download/Ukraine-Krieg%20im%20Liveticker%3A%20%2B%2B%2B%2015%3A15%20Putins%20%22Behauptungen%20machen%20%C3%BCberhaupt%20keinen%20Sinn%22%20%2B%2B%2B%20-%20n-tv.de.pdf
03-26 10:24:29.989 24518 24544 E ContentInputStream: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:151)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:814)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2043)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1858)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1773)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at org.mozilla.geckoview.ContentInputStream.isReadable(ContentInputStream.java:139)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
03-26 10:24:29.989 24518 24544 E ContentInputStream: 	at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:659)

A bit bizarre is I get this error if I do the flow "Save as PDF" and press "Open". However, I do not get this error if I navigate to the file in the file explorer and open with "Firefox". So, it seems to be an access or passing data problem?

When successfully opening from files the content is:
content://com.google.android.apps.nbu.files.provider/2/1000000464

Only showing logo error

This is an error occurring in the engine generating the PDF.

I was able to reproduce it both on Android and Desktop and Chrome this way:

  • This article or try any from https://www.n-tv.de (some have the issue, some do not)
  • On Android on Pixel 4a Android 14: Browser Menu -> Share -> Save as PDF
  • On Desktop on MacOS 14: Print -> Save as PDF

I didn't immediately see any CSS that would prevent printing (save as PDF runs through the print engine) or anything obvious e.g., @media print {display:none;} or similar. Same behavior also occurs in Chrome when trying to print.

I think we need to fully rule out that this website isn't blocking Printing / Save as PDF on purpose via CSS or similar since it is occurring cross-platform for this half of the bug.

Other considerations:

  • Android 14 changed how some things in downloads worked and we now target 34.
    • Could be an issue accessing the download folder when pressing "Open" in Firefox.
Flags: needinfo?(ohall)
See Also: → 1875087

I opened a pdf file with some + from the Files app in Firefox nightly and it works well.
The first part of the URI is org.mozilla.fenix.feature.downloads.fileprovider so it looks like the content provider is something under our control.
A quick look in searchfox gave me:
https://searchfox.org/mozilla-central/source/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt#193-197
Maybe the file path can't contain any + or cannot be too long.

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.