Skip to content

Commit 603f8b8

Browse files
committed
Create files once
1 parent 7b4f0c0 commit 603f8b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mammoth/docx/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def _part_with_body_reader(document_path, zip_file, part_paths):
156156
default=Numbering.EMPTY,
157157
)
158158

159+
files = Files(None if document_path is None else os.path.dirname(document_path))
160+
159161
def read_part(name, reader, default=_undefined):
160162
relationships = _read_relationships(zip_file, _find_relationships_path_for(name))
161163

@@ -165,7 +167,7 @@ def read_part(name, reader, default=_undefined):
165167
relationships=relationships,
166168
styles=styles,
167169
docx_file=zip_file,
168-
files=Files(None if document_path is None else os.path.dirname(document_path)),
170+
files=files,
169171
)
170172

171173
if default is _undefined:

0 commit comments

Comments
 (0)