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

Unified Diff: patch.py

Issue 1160663007: Fix filename checks (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Addressed review comments Created 5 years, 7 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patch.py
diff --git a/patch.py b/patch.py
index 7dcefc011ae81b155604c2e78432e75231cbb4ae..1bc608c9f9ef03fbd25752b51bc91eb75bff211a 100644
--- a/patch.py
+++ b/patch.py
@@ -54,10 +54,15 @@ class FilePatchBase(object):
if i in filename:
raise UnsupportedPatchFormat(
filename, 'Can\'t use \'%s\' in filename.' % i)
- for i in ('/', 'CON', 'COM'):
- if filename.startswith(i):
- raise UnsupportedPatchFormat(
- filename, 'Filename can\'t start with \'%s\'.' % i)
+ if filename.startswith('/'):
+ raise UnsupportedPatchFormat(
+ filename, 'Filename can\'t start with \'/\'.')
+ if filename == 'CON':
+ raise UnsupportedPatchFormat(
+ filename, 'Filename can\'t be \'CON\'.')
+ if re.match('COM\d', filename):
+ raise UnsupportedPatchFormat(
+ filename, 'Filename can\'t be \'%s\'.' % filename)
return filename
def set_relpath(self, relpath):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698