From 5fc70864f23c75ea315bfb1c011a4ed82a76ccf0 Mon Sep 17 00:00:00 2001 From: gagb Date: Wed, 18 Dec 2024 11:46:39 -0800 Subject: [PATCH] Run pre-commit --- src/markitdown/_markitdown.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/markitdown/_markitdown.py b/src/markitdown/_markitdown.py index 28770f4..040a586 100644 --- a/src/markitdown/_markitdown.py +++ b/src/markitdown/_markitdown.py @@ -1144,9 +1144,14 @@ class ZipConverter(DocumentConverter): # Safeguard against path traversal for member in zipObj.namelist(): member_path = os.path.normpath(os.path.join(extraction_dir, member)) - if not os.path.commonprefix([extraction_dir, member_path]) == extraction_dir: - raise ValueError(f"Path traversal detected in zip file: {member}") - + if ( + not os.path.commonprefix([extraction_dir, member_path]) + == extraction_dir + ): + raise ValueError( + f"Path traversal detected in zip file: {member}" + ) + # Extract all files safely zipObj.extractall(path=extraction_dir)