From 9cd0fc96c52e3ffd6054b030b14dd100001089a0 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Mon, 3 Oct 2005 18:33:49 +0100 Subject: [PATCH] Escape the unusual characters in the name strings Otherwise there are problems when passing the environment to git-commit. Signed-off-by: Catalin Marinas --- stgit/commands/common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.11.0