From b9ecdf8dfc3f6791f94bebe95c8f33465ad0a828 Mon Sep 17 00:00:00 2001 From: Katon Minhas Date: Wed, 15 Apr 2026 19:29:14 +0000 Subject: [PATCH] Merged in bugfix/empty-doc (pull request #957) Safe exit for empty docs * Safe exit for empty docs Approved-by: Siddhant Medar --- src/pipelines/saas/file_processing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pipelines/saas/file_processing.py b/src/pipelines/saas/file_processing.py index 7e28bdc..fec9b02 100644 --- a/src/pipelines/saas/file_processing.py +++ b/src/pipelines/saas/file_processing.py @@ -54,6 +54,11 @@ def process_file(file_object, constants: Constants, run_timestamp): with timing_utils.timed_block("preprocess", context=filename): contract_text = preprocess.clean_text(contract_text) text_dict, top_sheet_dict = preprocess.split_text(contract_text) + if not text_dict: + logging.warning( + f"{datetime_str()} All pages removed as cover sheets, skipping processing - {filename}" + ) + return final_results, pd.DataFrame([{"FILE_NAME": filename}]) text_dict, removal_metadata = preprocess.clean_header_footer(text_dict) # ONE TO N PROCESSING one_to_n_results = pd.DataFrame() # Initialize empty DataFrame for one_to_n_results