From abc24af1f25349bd6eac67a7b993c32df486825e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 20 Nov 2021 17:15:20 +0100 Subject: utils/mailcap: fix filename handling It is only relevant for the sanitize_attachment_filename hook, so never got triggered. --- alot/utils/mailcap.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'alot/utils') diff --git a/alot/utils/mailcap.py b/alot/utils/mailcap.py index 31a50d70..9dccd7a0 100644 --- a/alot/utils/mailcap.py +++ b/alot/utils/mailcap.py @@ -39,6 +39,7 @@ class MailcapHandler: _payload = None _ctype = None _params = None + _fname = None _need_tmpfile = None _tmpfile = None @@ -56,6 +57,7 @@ class MailcapHandler: self._payload = payload self._ctype = ctype self._params = tuple('='.join(p) for p in params) + self._fname = filename # in case the mailcap defined command contains no '%s', # we pipe the files content to the handling command via stdin @@ -76,7 +78,7 @@ class MailcapHandler: fn_hook = settings.get_hook('sanitize_attachment_filename') if fn_hook: - prefix, suffix = fn_hook(filename, prefix, suffix) + prefix, suffix = fn_hook(self._fname, prefix, suffix) tmpfile = NamedTemporaryFile(prefix = prefix, suffix = suffix) -- cgit v1.2.3