Handle binary data in diffs
Even though we won't usually display it, binary data may show up in a diff. We can't decode it to display it, so just replace it with a placeholder string so we don't crash. Change-Id: I4794e707745ed8315afec00c1981e239ec98ef0e
This commit is contained in:
parent
a8487746e7
commit
64b8d6dc6c
|
@ -544,7 +544,10 @@ class Repo(object):
|
|||
if isinstance(line, six.string_types):
|
||||
f.addContextLine(line)
|
||||
else:
|
||||
f.addContextLine(line.decode('utf8'))
|
||||
try:
|
||||
f.addContextLine(line.decode('utf8'))
|
||||
except:
|
||||
f.addContextLine("<binary data>")
|
||||
f.finalize()
|
||||
return files
|
||||
|
||||
|
|
Loading…
Reference in New Issue