Closed Bug 1898027 Opened 4 months ago Closed 4 months ago

Screenshots with long filenames fail to download on macOS and Ubuntu

Categories

(Firefox :: Screenshots, defect)

Desktop
All
defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox126 --- unaffected
firefox127 --- wontfix
firefox128 --- verified

People

(Reporter: sbadau, Assigned: niklas, NeedInfo)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 file)

Found in

  • Firefox 127.0b7

Affected versions

  • Firefox 127.0b7
  • Nightly 128.0a1

Tested platforms

  • Affected platforms: macOS 13, macOS 14, Ubuntu 22.04
  • Unaffected platforms: Windows 10, Windows 11

Steps to reproduce

  1. Navigate to this website with the long title:
    https://www.amazon.com/Purifiers-MOOKA-Purifier-Fragrance-Wildfire/dp/B0CP7QSRHV/ref=sr_1_3?_encoding=UTF8&content-id=amzn1.sym.68f2b66e-afdb-4a19-b88c-555da04d6dc2&crid=1QBODY970JKYC&dib=eyJ2IjoiMSJ9._3GXzCEJnUwCqhbUuXiWXv1MWMELlrXzAC5jhuBRUB5qVjcC7NG_dM2Nk1TMyq3mR_Mix8yk-JJx7CrnwQtDR-ZASsakeKKKdj0mWFsO0MQgksY4WGrt8lkzLaDaA96oO6JDK083pSM7MdR0wFErDxSnO_NHqaR2gg2ZrbF3IWi0goE76Tsjn2SxecXiTmllvRdQbysYh0OpDUsSCIYFayOaWdBpQMqgEFxrqUrT-tAsqbJ1whXrwuEclLo-kQuXo-J53wecpAFT79AvkduzPhh58bhIPhK6LT9jdG8MCiY.fFgPjuT3HoVrwYYiTcZKT27yL8eqgl3-1Xgb4MxokKI&dib_tag=se&keywords=Home&pd_rd_r=9b7fa24f-44c7-4414-957a-e517dfccae49&pd_rd_w=SSLkA&pd_rd_wg=Krswt&pf_rd_p=68f2b66e-afdb-4a19-b88c-555da04d6dc2&pf_rd_r=B3667J9M8PCBS6V3CQJ0&qid=1716235458&s=kitchen-intl-ship&sprefix=home%2Ckitchen-intl-ship%2C164&sr=1-3
  2. Enable Screenshots.
  3. Click on 'Save full page' and then on 'Download'.

Expected result

  • The screenshot should download successfully.

Actual result

  • The download fails. On MacOS the Save Dialog remains opened and unresponsive and the download does not go through.
    On Ubuntu, the download is found as failed in the download manager, the save dialog remains opened, but can be closed by pressing Cancel or Retry.

Regression range

  • No. The issue is not reproducible on the extension version of Screenshots.

Additional notes

  • The issue is not repro on Windows 10.
  • No ellipses are shown in the filename of the failed screenshot.
  • These errors are displayed in the Browser Console:

DOMException: Could not remove `/home/simona.marcu/Downloads/Screenshot 2024-05-21 at 19-37-14 Amazon.com Air Purifiers for Home Large Room Pets Up to 1300 Sq Ft MOOKA H13 True HEPA Air Purifier Cleaner with 360° Air Inlet Fragrance 13dB Air Purifier for Bedroom Wildfire Smoke Pet Dust Pollen Odor Home & Kitchen.png' (NS_ERROR_FILE_NAME_TOO_LONG) DownloadCore.sys.mjs:2636:19
_tryToRemoveFile resource://gre/modules/DownloadCore.sys.mjs:2636
Failed to create download using filename: /home/simona.marcu/Downloads/Screenshot 2024-05-21 at 19-37-14 Amazon.com Air Purifiers for Home Large Room Pets Up to 1300 Sq Ft MOOKA H13 True HEPA Air Purifier Cleaner with 360° Air Inlet Fragrance 13dB Air Purifier for Bedroom Wildfire Smoke Pet Dust Pollen Odor Home & Kitchen.png (length: 286)

Assignee: nobody → nbaumgardner
Status: NEW → ASSIGNED
Attachment #9403251 - Attachment description: Bug 1898027 - Update how max filename length for screenshots downloads.r=sfoster,kcochrane → Bug 1898027 - Update max filename length for screenshots downloads.r=sfoster,kcochrane

I think this patch also fixes the problem on Windows? In Firefox 126.0 for Windows, saving a screenshot of

https://x.com/FirefoxSupport/status/1791365172571083193

yields the file name

Screenshot 2024-05-27 at 08-58-49 Firefox Support on X Hey folks we are aware of the Twitter issue and our team is working on a fix at the moment. In the meantime disabling Enhanced Tracking Protection or changing it from Strict should fix this i[...].png

which fails. Currently, the only workaround is to set Firefox to "Always ask you where to save files" and manually fix file names.

Related thread: https://www.reddit.com/r/firefox/comments/1d1dfbr/firefox_screenshot_fail/

Pushed by nbaumgardner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e4176795bd84 Update max filename length for screenshots downloads.r=sfoster,kcochrane
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch

Verified as fixed using the latest Nightly 128.0a1 on macOS 13 and Ubuntu 22.04 – screenshots are now saved correctly.

However, I have noticed that on Windows 10, using the latest Nightly 128.0a1, the File icon in the Downloads panel is missing when downloading the link from the Description.
Niklas, could you please take a look at this issue?

Flags: needinfo?(nbaumgardner)

However, I have noticed that on Windows 10, using the latest Nightly 128.0a1, the File icon in the Downloads panel is missing when downloading the link from the Description.

I'm not able to reproduce. Can you file a bug for this?

Flags: needinfo?(nbaumgardner)
Regressions: 1900331

We have shared helpers for sanitizing filenames and analyzing whether they're too long, e.g. https://searchfox.org/mozilla-central/rev/d3fea1aa852bb3a353a0a4a875c3685da11ce39b/netwerk/mime/nsIMIMEService.idl#226

Can we use these instead? Right now it looks like screenshots is slowly rediscovering all the same limitations around filenames on different OSes and circumstances, and this is leading to a lot of duplicate work. :-)

Flags: needinfo?(nbaumgardner)

(In reply to :Gijs (he/him) from comment #7)

We have shared helpers for sanitizing filenames and analyzing whether they're too long, e.g. https://searchfox.org/mozilla-central/rev/d3fea1aa852bb3a353a0a4a875c3685da11ce39b/netwerk/mime/nsIMIMEService.idl#226

Can we use these instead? Right now it looks like screenshots is slowly rediscovering all the same limitations around filenames on different OSes and circumstances, and this is leading to a lot of duplicate work. :-)

This is probably my fault. We originally looked at trying to share the DownloadPaths.sanitize method that uses these helpers, and when that wasn't practical we fell back to tweaking the extension's implementation. Now that we have some tests, I would be interesting to see if swapping in to use the MIME service helpers would pass our tests.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: