summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/account.py4
-rw-r--r--alot/message.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/alot/account.py b/alot/account.py
index 1b7d35e2..ce096b28 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -4,6 +4,7 @@ import time
import re
import email
import os
+import shlex
from ConfigParser import SafeConfigParser
from urlparse import urlparse
@@ -320,7 +321,8 @@ class MatchSdtoutAddressbook(AddressBook):
return self.lookup('\'\'')
def lookup(self, prefix):
- resultstring = cmd_output('%s %s' % (self.command, prefix))
+ cmdlist = shlex.split(self.command.encode('utf-8', errors='ignore'))
+ resultstring = cmd_output(cmdlist + [prefix])
if not resultstring:
return []
lines = resultstring.replace('\t', ' ' * 4).splitlines()
diff --git a/alot/message.py b/alot/message.py
index e71d4043..0671a80b 100644
--- a/alot/message.py
+++ b/alot/message.py
@@ -3,6 +3,7 @@ import email
import tempfile
import re
import mimetypes
+import shlex
from datetime import datetime
from email.header import Header
import email.charset as charset
@@ -276,7 +277,8 @@ def extract_body(mail, types=None):
tmpfile.close()
#create and call external command
cmd = handler % tmpfile.name
- rendered_payload = helper.cmd_output(cmd)
+ cmdlist = shlex.split(cmd.encode('utf-8', errors='ignore'))
+ rendered_payload = helper.cmd_output(cmdlist)
#remove tempfile
os.unlink(tmpfile.name)
if rendered_payload: # handler had output