Fix the e-mail address escaping
authorCatalin Marinas <catalin.marinas@gmail.com>
Mon, 20 Feb 2006 21:26:22 +0000 (21:26 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 20 Feb 2006 21:27:37 +0000 (21:27 +0000)
This patch makes StGIT only escape the quotes in an e-mail address since
passing them unescaped as GIT_* environment variables can cause problems.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/common.py

index f7301da..2e1ba7a 100644 (file)
@@ -136,7 +136,7 @@ def name_email(address):
     """Return a tuple consisting of the name and email parsed from a
     standard 'name <email>' string
     """
-    address = re.sub('([^\w\s<>@.])', '\\\\\\1', address)
+    address = re.sub('[\\\\"]', '\\\\\g<0>', address)
     str_list = re.findall('^(.*)\s*<(.*)>\s*$', address)
     if not str_list:
         raise CmdException, 'Incorrect "name <email>" string: %s' % address
@@ -147,7 +147,7 @@ def name_email_date(address):
     """Return a tuple consisting of the name, email and date parsed
     from a 'name <email> date' string
     """
-    address = re.sub('([^\w\s<>@.])', '\\\\\\1', address)
+    address = re.sub('[\\\\"]', '\\\\\g<0>', address)
     str_list = re.findall('^(.*)\s*<(.*)>\s*(.*)\s*$', address)
     if not str_list:
         raise CmdException, 'Incorrect "name <email> date" string: %s' % address