Add protected against empty binary file and disable all binary file support.

If a file is empty, it's not a binary file in the first place. This is to
protect against improper uploads.
From light testing, it seems binary file support is totally broken. This needs to be verified throughout before being enabled back.

TBR=rogerta@chromium.org
BUG=23608


Review URL: https://chromiumcodereview.appspot.com/11016032

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@159941 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 13 years ago
parent cd8d8e1702
commit de85d9c794

@ -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:

Loading…
Cancel
Save