From cb40d621621750a90cffd00c9fefe7d65914a801 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 4 Jul 2025 15:53:37 +0800 Subject: [PATCH] refactor: allow loading of truncated images and increase max pixel limit in common_handle.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1057749 --user=刘瑞斌 【知识库】qa问答对文档中带图片,导入后图片未显示 https://www.tapd.cn/62980211/s/1723700 --- apps/common/handle/impl/common_handle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/common/handle/impl/common_handle.py b/apps/common/handle/impl/common_handle.py index db291c572..1b1968d97 100644 --- a/apps/common/handle/impl/common_handle.py +++ b/apps/common/handle/impl/common_handle.py @@ -22,6 +22,9 @@ from openpyxl.xml.constants import SHEET_DRAWING_NS, REL_NS, SHEET_MAIN_NS from common.utils.logger import maxkb_logger from knowledge.models import File +from PIL import ImageFile +ImageFile.LOAD_TRUNCATED_IMAGES = True +PILImage.MAX_IMAGE_PIXELS = None def parse_element(element) -> {}: data = {}