Re: [PATCH] Fix attachment saving to use the basename of the filename.
"Kevin J. McCarthy" <[email protected]> Tue, 5 May 2026 07:38:58 +0800
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <afkuEl6BmXJMj1Gn@qinghai> |
On Mon, May 04, 2026 at 10:01:34AM +0200, Vincent Lefevre wrote: >On 2026-05-04 15:29:15 +0800, Kevin J. McCarthy wrote: >> Elsewhere in the mutt_save_attachment_list() flow, care is taken to >> use the basename, but not in the most basic case. >> >> It almost seems deliberate, but if so I think it's a poor choice. >> Always use the basename. Don't allow a distracted user to >> accidentally save random files elsewhere in their filesystem. > >BTW, in the mail I received, the slashes were actually part of a date >as often written in French: "03/05/2026". I'm wondering whether the >RFCs give a special meaning to the slashes for the filename value >(such as a directory separator, which should be ignored), i.e. whether >this is an error from the sender (who used slashes in an incorrect >manner) or slashes should rather be replaced by another character >on the MUA side. Some non-POSIX systems use another character as a >directory separator (e.g. "\" on MS-DOS/Windows, "." on RISC OS), >so that the filename in question from the mail could be regarded as >being a fully valid filename on such systems if the RFCs do not say >anything special. So, here (as on other systems where the directory >separator is "/"), replacing the "/" by another character could be >an alternative solution in order to keep more information from the >mail. I'll take a look this weekend. One concern I have is that the save attachment logic is shared in the compose menu (bound to "C"), which passes in the full path name of the attachment. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmn5LhIACgkQre92hIAx a9o9LRAAxA0G4y5cwfznZxmfFfEJ+QxWAwfFx8XeJe0dy6zST4GyYI2Tn1WgcGEX pZflPrJbBYM7v1IHWP1UMaUCXNMYCAwrTPZ2hClKYlYgyNitkQwRHX2ZCEyrmisV z0Vb6keSp4pafgt0V1YCd8WH9T7qMj27ExDfcnnPJiL0NZKEqazA1JNWs44D/KgO 5ZvLaqSUj2/Zr1QgtzJdqYpzzsZjCTNk6eOw1/6ktL1FpyxuTcUJYV8SCk2EMPA5 oOcCVIUrZElM3QsqeMMuTjbfW/7ys3MauzAViOQ4DBW07LGtlbrZdOHhVUrqvkiM tgDENRLDnpBlBp1zb5SdTljlmIpaypIsoCwQsovc5R9FYiwBtRAGhQtx2ONluenj 8BdCYUTWbgZzyT4dFn2iVhIJz7qvMgCn1iOO9cUVJb4+NuhFjwcYkDAxyZkFZLPO 71JJsR3f88RVoCl85+hWoV5V+5jFmWegm8Qb4+4odPSoWOllRedCkWy8vYKUCdpj Bq0T0WB0gxG1mMEVkjJykORmdjVn4sblGvnHlkYvWfWVbr9lvKDvgOI7/8rO3sm/ RF9/fwXHca1k28+dO9hCLGq3mlVBpOTGl/FpqmOF/nLrihLEv4skbCiHd393wjRn TfcZ8hatnKt1DmqTQoN6Z9T3GSik83cVkpB7yRHIZmtcAteZrrM= =KcO/ -----END PGP SIGNATURE-----