diff --git a/apps/common/handle/impl/text/pdf_split_handle.py b/apps/common/handle/impl/text/pdf_split_handle.py index 3e416285b94..a83d718c6ae 100644 --- a/apps/common/handle/impl/text/pdf_split_handle.py +++ b/apps/common/handle/impl/text/pdf_split_handle.py @@ -58,10 +58,10 @@ def handle( get_buffer, save_image, ): + buffer = get_buffer(file) with tempfile.NamedTemporaryFile(delete=False) as temp_file: # 将上传的文件保存到临时文件中 - for chunk in file.chunks(): - temp_file.write(chunk) + temp_file.write(buffer) # 获取临时文件的路径 temp_file_path = temp_file.name diff --git a/apps/common/handle/impl/text/zip_split_handle.py b/apps/common/handle/impl/text/zip_split_handle.py index 14f1b7c310a..2366e43ea1c 100644 --- a/apps/common/handle/impl/text/zip_split_handle.py +++ b/apps/common/handle/impl/text/zip_split_handle.py @@ -28,6 +28,7 @@ from common.handle.impl.text.xls_split_handle import XlsSplitHandle from common.handle.impl.text.xlsx_split_handle import XlsxSplitHandle from common.utils.common import parse_md_file_link, parse_md_image +from common.utils.logger import maxkb_logger class FileBufferHandle: @@ -170,8 +171,8 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu result = [*result, *value] else: result.append(value) - except Exception: - pass + except Exception as e: + maxkb_logger.warning(f"Zip member: {file}, split error: {e}") image_list = get_image_list(result, files) result = filter_image_file(result, image_list) image_mode_list = []