Closed Bug 2071966 Opened 2 months ago Closed 18 hours ago

Sharing/downloading a PDF from a file doesn't populate a meaningful name

Categories

(GeckoView :: PDF Viewer, defect)

All
Android
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: olivia, Assigned: olivia)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][group6])

Attachments

(3 external files)

Bug 2064934 needs solved first to turn on local downloading. It seems like unrelated data is used for the file name when downloading a local PDF.

Maybe needs re-verification before acting on this. I don't think I saw it the second time I tried (?).

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

For more information, please visit BugBot documentation.

Flags: needinfo?(ohall)
Severity: N/A → S3
Flags: needinfo?(ohall)

I saw this again, it might be PDF dependent. Dependency on bug 2064727, since it makes some adjustments in the area too for sharing.

Depends on: 2064727

verifyDownloadedPDFIsOpenedInFirefoxTest will need to be changed when this is fixed.

Assignee: nobody → ohall
Summary: Downloading a PDF from a file doesn't populate a meaningful name → Sharing a PDF from a file doesn't populate a meaningful name

I'm retesting this to understand the problem, I think download is impacted on certain conditions too. I'll follow up with some more testing.

Summary: Sharing a PDF from a file doesn't populate a meaningful name → Sharing/downloading a PDF from a file doesn't populate a meaningful name

Sharing:

  • Always has a random number name from going through a temp file

Downloads:

  • Local PDF:
    • Tab displays "PDF Title - randomnumber.pdf"
    • Download file is "PDF Title - randomnumber.pdf"
  • Remote PDF:
    • Tab displays "PDF Title - filename.pdf"
    • Download file is the same
  • Local Signed PDF
    • Tab displays "* PDF Title - filename.pdf" <- star appends after signing
    • Download file is "* PDF Title - randomnumber.pdf"
  • Remote Signed PDF:
    • Tab displays "* PDF Title - filename.pdf" <- star appends after signing
    • Download file is "_ PDF Title - randomnumber.pdf" <- notice _, I think * is being transformed
  • Some PDFs seem to be missing title metadata and will show "Untitled - filename.pdf"

I think that gives us a couple of things to solve, some might be parts on this ticket or otherwise split off. I think some things might have the same root problem.

Issues, in somewhat order of severity:

  • Share should have a meaningful name, especially since it cannot be changed.
  • Local PDFs should ideally have metadata attached about the filename
  • Get information on what * is doing in the PDF metadata title after signing and if we can remove that
  • Request product/UI/UX guidance on filename:
    • I kinda suspect going with "filename.pdf" is more ideal than "PDF Title - filename.pdf", especially in the "Untitled" metadata cases
  • Consider removing "Untitled" when we don't have PDF metadata, minor bug since it is reflecting the reality of the PDF. Probably best to get product/UI/UX behavior here.

Asked for UI/UX guidance on what the ideal filename we should be striving for downloading and sharing, because the default seems to be all over the place depending on how the file came into Android.

Confirmed UI/UX guidance for filenames:

  1. Use the filename when available, so whatthewebsitenamedit.pdf
  2. iff (1) isn't available, then use the Title the PDF identifies as The PDFs Metadata Title.pdf
  3. iff (1 and 2) isn't available, then use a default neutral title such as Document.pdf
  • I'll check if we already have this string for downloads or if the Android platform naturally has one as an option, otherwise I'll also ask for that string.

(Slack)

Outline I'm seeing right now:

  • Part 1: Download - Get current general download behavior as outlined in Comment 8, ideally reusable for share
  • Part 2: Local Download - Get local PDFs sending over more data about filename instead of random number
  • Part 3: Share - Get share corrected to use the Comment 8 logic instead of temp filename

Get information on what * is doing in the PDF metadata title after signing and if we can remove that

Confirmed this is expected just to signify changes occurred.

This change ensures the PDF naming preference is as follows:
1st choice: Filename - "filename.pdf" as named by the server, when available
2nd choice: Title - "Title.pdf" as named by the tab metadata, for a PDF viewer tab, it is the PDF title metadata
3rd choice: Fallback - "document.pdf", when we don't have good information on what to do

Before this change, "Title - filename.pdf" was the preferred name when downloading a PDF.

Attachment #9672568 - Attachment description: WIP: Bug 2071966 - Part 1: Ensure the name when downloading a PDF is consistent → Bug 2071966 - Part 1: Ensure the name when downloading a PDF is consistent

This patch adjusts the share flow to have a "Content-Disposition" with the filename provided and to use the new filename for sharing. To prevent naming collisions, a folder with a random ID is made in the media cache directory to contain the file. (Before this patch, the temporary file itself had the random ID.)

This patch changes content:// local PDFs to have a known filename associated in their "Content-Disposition".

Attachment #9673627 - Attachment description: Bug 2071966 - Part 3: Provide local PDFs a filename → Bug 2071966 - Part 3: Use the content provider filename for local PDFs
Keywords: leave-open
Pushed by ohall@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/27319fa22a9b https://hg.mozilla.org/integration/autoland/rev/dfc2aaf3be02 Part 1: Ensure the name when downloading a PDF is consistent r=android-reviewers,mobiletest-reviewers,aaronmt,pollymce https://github.com/mozilla-firefox/firefox/commit/dc991bb5dcc3 https://hg.mozilla.org/integration/autoland/rev/4d4ed9fab7b5 Part 2: Keep the filename when sharing a PDF r=android-reviewers,pollymce
Pushed by ohall@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1ac3dd398f77 https://hg.mozilla.org/integration/autoland/rev/6d7849ad05c7 Part 3: Use the content provider filename for local PDFs r=geckoview-reviewers,tcampbell,android-reviewers
Status: NEW → RESOLVED
Closed: 18 hours ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: