Closed Bug 1910185 Opened 8 months ago Closed 2 months ago

Filenames are not being truncated with ellipsis to fit max file length correctly

Categories

(Fenix :: Downloads, defect)

All
Android
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: npoon, Assigned: npoon)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][group4])

Attachments

(1 file)

Steps to reproduce

  1. Click on the Long Title website uploaded as an attachment.
  2. Click on the share icon on the toolbar (next to the 3 dots menu icon)
  3. Click on "Save as PDF"
  4. Observe that the Save-as dialog shows that the generated filename will be the following:
  • ThisIsAnExtremelyLongTitle1ThisIsAnExtremelyLongTitle2ThisIsAnExtremelyLongTitle3ThisIsAnExtremelyLongTitle4ThisIsAnExtremelyLongTitle5ThisIsAnExtremelyLongTitle6ThisIsAnExtremelyLongTitle7ThisIsAnExtremelyLongTitle8ThisIsAnExtremelyLongTitle9ThisIsAn.pdf
  1. The actual generated filename is the following different filename:
  • ThisIsAnExtremelyLongTitle1ThisIsAnExtremelyLongTitle2ThisIsAnExtremelyLongTitle3ThisIsAnExtremelyLongTitl...Title5ThisIsAnExtremelyLongTitle6ThisIsAnExtremelyLongTitle7ThisIsAnExtremelyLongTitle8ThisIsAnExtremelyLongTitle9ThisIsAn.pdf

Expected behavior

The filename that we show in save-as is exactly 255 characters long -- seems like we're truncating to satisfy that as an upper-limit.
And then the actual final filename is 235 characters long. Maybe that's because Android is truncating so that the full path (including the directory) is 255 characters? (with some 20-character directory name like /sdcard0/downloads/ as a prefix, or whatever).

It might be worth adjusting our own truncation logic to be a bit more conservative so that we don't trigger this odd double-truncation where we reliably lose just a few characters in the middle with a "...".

Severity: -- → N/A
See Also: → 1862795
Whiteboard: [fxdroid][group4]
Attached file Long Title.html

Relevant additional information from bug 1862795 comment 5, RE the filename ending up 235 characters long here:

Interesting, my "Files" app lets me rename the file to be the full 255 characters long (e.g. I can add the 20 characters aaaaabbbbbcccccddddd at the end; and then if I try to add one more character after that, it won't let me).

So whoever is doing that middle-ellipsizing-to-shrink-to-235-characters (maybe that's us?) is doing so unnecessarily.

Assignee: nobody → npoon
Status: NEW → ASSIGNED
See Also: → 1880023
Blocks: 1904019
Severity: N/A → S2
Type: task → defect
Summary: Investigate whether filenames are being truncated to fit max file length correctly → Filenames are not being truncated with ellipsis to fit max file length correctly

Looks like this feature will only be available in Compose UI in 1.8.0 --> https://issuetracker.google.com/issues/185418980#comment15

I retested the attached long filename and Bug 1880023 fixed this. In both the download request dialog and completed dialog, the filename matches and is shortened to fit: ThisIsAnExtremelyLongTitle1ThisIsAnExtremelyLongTitle2ThisIsAnExtremelyLongTitle3ThisIsAnExtremelyLongTitle4ThisIsAnExtremelyLongTitle5ThisIsAnExtremelyLongTitle6ThisIsAnExtremelyLongTitle7ThisIsAnExtremelyLongTitle8.pdf.

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: