Skip to content

Commit 9182923

Browse files
authored
Don't have ZipConverter accept OOXML files. This will never yield a good result. (#1078)
1 parent 9a19fdd commit 9182923

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/markitdown/src/markitdown/converters/_zip_converter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def convert(
7777
try:
7878
# Extract the zip file safely
7979
with zipfile.ZipFile(local_path, "r") as zipObj:
80+
# Bail if we discover it's an Office OOXML file
81+
if "[Content_Types].xml" in zipObj.namelist():
82+
return None
83+
8084
# Safeguard against path traversal
8185
for member in zipObj.namelist():
8286
member_path = os.path.normpath(os.path.join(extraction_dir, member))

0 commit comments

Comments
 (0)