summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2015-12-16 16:10:39 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2015-12-16 16:10:39 +0000
commit81b010380a373ee11454f3baeac718a545239a08 (patch)
tree099ca54965abee0d36d563b30ccd177310bf79a2 /alot
parent96126036a672b75b071a7d6c5aef8e4aced10eee (diff)
parent0042fc710dfcc93d9c09891c388fae2797ce052f (diff)
Merge branch '0.3.6-feature-sanitize-attachments-811'
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/thread.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 67888255..6349fe2b 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -926,6 +926,13 @@ class OpenAttachmentCommand(Command):
if '%s' in handler_raw_commandstring:
nametemplate = entry.get('nametemplate', '%s')
prefix, suffix = parse_mailcap_nametemplate(nametemplate)
+
+ fn_hook = settings.get_hook('sanitize_attachment_filename')
+ if fn_hook:
+ # get filename
+ filename = self.attachment.get_filename()
+ prefix, suffix = fn_hook(filename, prefix, suffix)
+
tmpfile = tempfile.NamedTemporaryFile(delete=False,
prefix=prefix,
suffix=suffix)