4958: Diff error bundle uses wrong string type on Python 3 (bytes vs. unicode)
- Fixed
- Review Board
david | |
What version are you running?
4.0.5
What's the URL of the page containing the problem?
Diff error bundle.
What steps will reproduce the problem?
- Have a review request with a patch that cannot be applied.
- Attempt to download the error bundle.
What is the expected output? What do you see instead?
Bundle view results in this error:
Traceback (most recent call last): File "/venv/lib/python3.8/site-packages/reviewboard/diffviewer/views.py", line 849, in get zipfile.writestr('%s.orig' % basename, patch_error.orig_file) File "/usr/lib/python3.8/zipfile.py", line 1816, in writestr with self.open(zinfo, mode='w') as dest: File "/usr/lib/python3.8/zipfile.py", line 1517, in open return self._open_to_write(zinfo, force_zip64=force_zip64) File "/usr/lib/python3.8/zipfile.py", line 1614, in _open_to_write self.fp.write(zinfo.FileHeader(zip64)) TypeError: string argument expected, got 'bytes'Looks like we need to open the ZipFile as binary instead of text. This only occurs on Python 3 due to Python 2's wishy-washiness with string types.