fix: skip temporary docx files (#2413)

fix: CLI detects docx temporary files and breaks

Signed-off-by: Victor Moreli <victormoreli64@gmail.com>
This commit is contained in:
Victor Moreli
2025-10-10 04:39:26 -03:00
committed by GitHub
parent b5f7fef29b
commit ee5501320e

View File

@@ -547,13 +547,25 @@ def convert( # noqa: C901
if local_path.exists() and local_path.is_dir(): if local_path.exists() and local_path.is_dir():
for fmt in from_formats: for fmt in from_formats:
for ext in FormatToExtensions[fmt]: for ext in FormatToExtensions[fmt]:
input_doc_paths.extend( for path in local_path.glob(f"**/*.{ext}"):
list(local_path.glob(f"**/*.{ext}")) if path.name.startswith("~$") and ext == "docx":
) _log.info(
input_doc_paths.extend( f"Ignoring temporary Word file: {path}"
list(local_path.glob(f"**/*.{ext.upper()}")) )
) continue
input_doc_paths.append(path)
for path in local_path.glob(f"**/*.{ext.upper()}"):
if path.name.startswith("~$") and ext == "docx":
_log.info(
f"Ignoring temporary Word file: {path}"
)
continue
input_doc_paths.append(path)
elif local_path.exists(): elif local_path.exists():
if not local_path.name.startswith("~$") and ext == "docx":
_log.info(f"Ignoring temporary Word file: {path}")
continue
input_doc_paths.append(local_path) input_doc_paths.append(local_path)
else: else:
err_console.print( err_console.print(