Commit ed68d975 authored by maruel@chromium.org's avatar maruel@chromium.org

Blacklist more characters when sending a try job.

Otherwise files containing these characters can be created on the file system,
making it harder to get rid of those files.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/4127014

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@64782 0039d316-1c4b-4281-b951-d872f2087c98
parent 8e13a094
......@@ -40,7 +40,7 @@ class TryChangeUnittest(TryChangeTestsBase):
"""General trychange.py tests."""
def testMembersChanged(self):
members = [
'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff', 'HELP_STRING',
'EPILOG', 'Escape', 'GIT', 'GuessVCS', 'GetMungedDiff', 'HELP_STRING',
'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', 'SCM', 'SVN',
'TryChange', 'USAGE',
'breakpad', 'datetime', 'errno', 'gcl', 'gclient_utils', 'getpass',
......
......@@ -85,8 +85,11 @@ class NoTryServerAccess(Exception):
return self.args[0] + '\n' + HELP_STRING
def EscapeDot(name):
return name.replace('.', '-')
def Escape(name):
"""Escapes characters that could interfere with the file system or try job
parsing.
"""
return re.sub(r'[^\w#-]', '_', name)
class SCM(object):
......@@ -378,7 +381,7 @@ def _SendChangeSVN(options):
# Diff file
current_time = str(datetime.datetime.now()).replace(':', '.')
file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) +
file_name = (Escape(options.user) + '.' + Escape(options.name) +
'.%s.diff' % current_time)
full_path = os.path.join(temp_dir, file_name)
gclient_utils.FileWrite(full_path, options.diff, 'wb')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment