Address code review feedback on temporary file handling

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-01 14:05:51 +00:00
parent 859a0825d0
commit b17bba225f
+3 -2
View File
@@ -67,8 +67,9 @@ def embed_metadata_into_pdf(local_file_path: str, extracted_text: str, metadata:
original_file = local_file_path original_file = local_file_path
# Create a temporary file with the same extension as the original # Create a temporary file with the same extension as the original
_, ext = os.path.splitext(local_file_path) _, ext = os.path.splitext(local_file_path)
with tempfile.NamedTemporaryFile(mode='wb', suffix=ext, prefix='processed_', delete=False) as tmp_file: tmp_file = tempfile.NamedTemporaryFile(mode='wb', suffix=ext, prefix='processed_', delete=False)
processed_file = tmp_file.name processed_file = tmp_file.name
tmp_file.close()
# Create a safe copy to work on # Create a safe copy to work on
shutil.copy(original_file, processed_file) shutil.copy(original_file, processed_file)