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

Unified Diff: rietveld.py

Issue 11016032: Add protected against empty binary file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Disallow all binary files Created 8 years, 2 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: rietveld.py
diff --git a/rietveld.py b/rietveld.py
index e0bd7a54adc91b68155ab209ca83c7e7159c52e0..a03fe77e3e8d216ca0e8590919d62d800ffa423a 100644
--- a/rietveld.py
+++ b/rietveld.py
@@ -136,11 +136,24 @@ class Rietveld(object):
filename, 'Deleted file shouldn\'t have property change.')
out.append(patch.FilePatchDelete(filename, state['is_binary']))
else:
- out.append(patch.FilePatchBinary(
+ content = self.get_file_content(issue, patchset, state['id'])
+ if not content:
+ # As a precaution due to a bug in upload.py for git checkout, refuse
+ # empty files. If it's empty, it's not a binary file.
+ raise patch.UnsupportedPatchFormat(
+ filename,
+ 'Binary file is empty. Maybe the file wasn\'t uploaded in the '
+ 'first place?')
+ raise patch.UnsupportedPatchFormat(
filename,
- self.get_file_content(issue, patchset, state['id']),
- svn_props,
- is_new=(status[0] == 'A')))
+ 'Binary file support is temporarilly disabled due to a bug. '
+ 'Please commit blindly the binary files first then commit the '
+ 'source change as a separate CL. Sorry for the annoyance.')
+ #out.append(patch.FilePatchBinary(
+ # filename,
+ # content,
+ # svn_props,
+ # is_new=(status[0] == 'A')))
continue
try:
« 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