Ticket 351 on gitlab (https://gitlab.com/muttmua/mutt/-/issues/351) noted that an attachment 中文名称.txt, when launched via a mailcap viewer, created a tempfile "____________.txt".

This is because of the sanitize_filename() functions, which have an allow-list of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+@{}._-:%/" (with the '/' disabled for filenames).

I'd be reluctant to change sanitization for the %{<parameter>} or %t expandos, but this does seem to be a bit strict for the filename. Oswald notes in the ticket that 8-bit characters are harmless at the system level (Oswald, feel free to reply/clarify - I'm not trying to put words in your mouth).

On the one hand these are temp files, but Mutt already tries to preserve the filename to make for a nicer user interaction. It seems if we can preserve unicode filenames better we ought to do that too.

What if we added an allow_8bit parameter to the function, that also passed through bytes with the 8th bit set? I'd keep this set off in all other invocations except the mailcap invocations.

Comments?

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to