From 716a777bd883de7e9b23caf659bf6876f835473b Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sun, 3 Jun 2012 13:12:52 +0100 Subject: add helper split_commandstring that splits a command string into a list of strings to pass on to subprocess.Popen and the like. This helper is now used throughout the application instead of calling shlex.split directly as this is a potential source for errors because shlex is not yet able to properly deal with unicode bytestrings. --- alot/db/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'alot/db') diff --git a/alot/db/utils.py b/alot/db/utils.py index 55073e45..e9d40c21 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -2,7 +2,6 @@ import os import email import tempfile import re -import shlex from email.header import Header import email.charset as charset charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8') @@ -15,6 +14,7 @@ from alot.settings import settings from alot.helper import string_sanitize from alot.helper import string_decode from alot.helper import parse_mailcap_nametemplate +from alot.helper import split_commandstring def extract_headers(mail, headers=None): @@ -99,7 +99,7 @@ def extract_body(mail, types=None): filename=tmpfile.name, plist=parms) logging.debug('command: %s' % cmd) logging.debug('parms: %s' % str(parms)) - cmdlist = shlex.split(cmd.encode('utf-8', errors='ignore')) + cmdlist = split_commandstring(cmd) # call handler rendered_payload, errmsg, retval = helper.call_cmd(cmdlist) # remove tempfile -- cgit v1.2.3