diff options
author | Hossein <hossein@libreoffice.org> | 2022-02-12 21:21:36 +0100 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-02-12 23:51:36 +0330 |
commit | adf707e6680ffc03fbd7cd1948a1b0290825214a (patch) | |
tree | 77d1bc445540420afc498d386c2fa946d0241fb5 /msodumper/msodraw.py | |
parent | 6c81a12ef517ac5754214cd3d7e66c043c076def (diff) |
Fix doc-dump.py problem with dumping binary data
I was getting this error when invoking:
./doc-dump.py test/doc/pass/tdf141049.doc
...
File "mso-dumper/msodumper/msodraw.py", line 40, in inflate
return textwrap.fill(base64.b64encode(zlib.decompress(bytes)), width=160)
File "/usr/lib/python3.8/textwrap.py", line 391, in fill
return w.fill(text)
File "/usr/lib/python3.8/textwrap.py", line 363, in fill
return "\n".join(self.wrap(text))
File "/usr/lib/python3.8/textwrap.py", line 351, in wrap
chunks = self._split_chunks(text)
File "/usr/lib/python3.8/textwrap.py", line 337, in _split_chunks
text = self._munge_whitespace(text)
File "/usr/lib/python3.8/textwrap.py", line 156, in _munge_whitespace
text = text.translate(self.unicode_whitespace_trans)
TypeError: a bytes-like object is required, not 'dict'
To check:
cd test/doc && ./test.py
Or simply run all the tests:
make check
The test fails without this fix in place.
Change-Id: I1573ed0568ceb46c01847008fad0c49d1142420c
Diffstat (limited to 'msodumper/msodraw.py')
-rw-r--r-- | msodumper/msodraw.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/msodumper/msodraw.py b/msodumper/msodraw.py index 15f6a9c..73b698d 100644 --- a/msodumper/msodraw.py +++ b/msodumper/msodraw.py @@ -37,7 +37,7 @@ def hexdump(value): return "".join(ret) def inflate(bytes): - return textwrap.fill(base64.b64encode(zlib.decompress(bytes)), width=160) + return textwrap.fill(base64.b64encode(zlib.decompress(bytes)).decode(), width=160) class RecordHeader: |