Apply suggestion since part.blob changes type in the loop

Co-authored-by: Chatnoir Miki <cmiki@amono.me>
This commit is contained in:
Bart Broere 2024-10-24 07:27:59 +02:00 committed by GitHub
parent 9124386b4c
commit 0d616add84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -360,7 +360,7 @@ class DocxTemplate(object):
for section in self.docx.sections:
for part in section.part.package.parts:
if part.content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml':
xml = self.patch_xml(part.blob.decode('utf8'))
xml = self.patch_xml(part.blob.decode('utf-8') if type(part.blob) is bytes else part.blob)
xml = self.render_xml_part(xml, part, context, jinja_env)
part._blob = xml