From: Catalin Marinas Date: Mon, 3 Oct 2005 17:33:49 +0000 (+0100) Subject: Escape the unusual characters in the name strings X-Git-Tag: v0.14.3~645 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/9cd0fc96c52e3ffd6054b030b14dd100001089a0 Escape the unusual characters in the name strings Otherwise there are problems when passing the environment to git-commit. Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 68bd39b..4e4a79f 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -117,7 +117,8 @@ def name_email(string): """Return a tuple consisting of the name and email parsed from a standard 'name ' string """ - str_list = re.findall('^(.*)\s+<(.*)>$', string) + string = re.sub('([^\w\s<>@.])', '\\\\\\1', string) + str_list = re.findall('^(.*)\s*<(.*)>\s*$', string) if not str_list: raise CmdException, 'Incorrect "name " string: %s' % string @@ -127,7 +128,8 @@ def name_email_date(string): """Return a tuple consisting of the name, email and date parsed from a 'name date' string """ - str_list = re.findall('^(.*)\s+<(.*)>\s+(.*)$', string) + string = re.sub('([^\w\s<>@.])', '\\\\\\1', string) + str_list = re.findall('^(.*)\s*<(.*)>\s*(.*)\s*$', string) if not str_list: raise CmdException, 'Incorrect "name date" string: %s' % string