savescreenshot icon indicating copy to clipboard operation
savescreenshot copied to clipboard

Saving screenshots for pages with long titles can fail due to OS path length limit

Open pinnie opened this issue 3 months ago • 2 comments

Pages with very long titles can fail to save due to exceeding the default Windows path limit of 260 characters. Example page with a 266-character title:

https://archive.org/details/microsoftwindo9500micr

Saves fine when using Firefox's built-in function directly as it truncates the title where required. Absent an easy way for the add-on to check the host OS's limit and behave accordingly, maybe a user setting that applies to %title? For practical purposes, being able to set a significantly shorter limit can be helpful more generally as files with a path length near the limit can make a nuisance of themselves (e.g. Windows will let you move such a file to a deeper folder in a way that causes it to exceed the path limit, which then creates issues such as not being able to rename the file), but I understand if that concern is out of scope.

Not a new issue or anything, just something I've experienced for quite a while and finally getting around to reporting it :)

pinnie avatar Sep 17 '25 09:09 pinnie

What Firefox does here is not that complex. I did a few tries and found that all they are doing is limiting the file name to 60 characters.

Hitting "Ctrl + S" to save the actual HTML does not have this feature and will fail to save if you don't edit the filename.

I'm still unsure how to fix this. Limiting the title does not help as the URL could also be very long.

Probably a new option to limit file name size, preconfigured for 60 characters.

M-Reimer avatar Sep 18 '25 14:09 M-Reimer

I get different behaviour (Firefox 142 on Windows 10 21H2). It truncates the filename to whatever results in a 260 character path length. Example with the above link and two different folders:

C:\Users\Steven\Downloads\Screenshot 2025-09-19 at 01-53-03 Microsoft Windows 95 resource kit the technical guide to planning for installing configuring and supporting Windows 95 in your organization the professional's companion to Windows 95 Microso[...].png

D:\Download\Screenshot 2025-09-19 at 01-57-27 Microsoft Windows 95 resource kit the technical guide to planning for installing configuring and supporting Windows 95 in your organization the professional's companion to Windows 95 Microsoft Press Free [...].png

Although I'm not a fan of that anyway for the reason mentioned previously (e.g. Windows will let me move the second file above to the first folder, exceeding the default path length limit and creating weird issues), so I like the idea of a configurable filename length limit from a practical standpoint.

pinnie avatar Sep 18 '25 16:09 pinnie