bug(downloads): collision suffix exceeds Linux filename length limit
A file with a valid 255-byte Linux filename downloads once, but downloading it again fails because AO's collision suffix makes the name too long.
Repro
- Serve a file with a name consisting of 251 ASCII
acharacters followed by.txt. - Download it successfully.
- Download the same file again.
AO chooses a name ending in (1).txt, making it 259 bytes long. The second download becomes interrupted with zero bytes received. Writing to that chosen path separately returns ENAMETOOLONG.
The collision name should stay within the filesystem's filename limit. collisionSafePath appends a suffix without shortening the original name.
Test notes: Fedora 44, dd67f2d818. Reproduced with real Electron downloads from a local HTTP server. The failed transfer was cancelled only after its interrupted state was recorded.
Screenshots
The first download completes; the repeated download is interrupted.