Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1207)

Unified Diff: trychange.py

Issue 4127014: Blacklist more characters when sending a try job. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Use whitelist instead of blacklist, fix unit test Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index 6021623696e398f71d691d00bf8c3bb0c8411879..5d73cb71d0ec272784c7e2f2a02cfafcfbd72dad 100755
--- a/trychange.py
+++ b/trychange.py
@@ -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')
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698