summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-11-20 17:15:20 +0100
committerAnton Khirnov <anton@khirnov.net>2021-11-20 17:15:20 +0100
commitabc24af1f25349bd6eac67a7b993c32df486825e (patch)
tree62a652f5359da23b099f14e1a34b3e92329f8f44
parentf2a92d0123240e41493215adcc2e0dfa9e7fadbb (diff)
utils/mailcap: fix filename handling
It is only relevant for the sanitize_attachment_filename hook, so never got triggered.
-rw-r--r--alot/db/message.py2
-rw-r--r--alot/utils/mailcap.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index 014218a6..19a0f043 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -224,7 +224,7 @@ class _MimeTree:
# try procesing content with an external program
rendered = _render_part_external(content, self.content_type,
self._part.get_params(),
- 'copiousoutput')
+ self.filename)
if rendered:
return rendered
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)