From 8b31fd6b36e103d2db8ec2c5342ef8f4fccdfbfb Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Wed, 10 Apr 2024 17:05:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E6=AE=B5=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=96=87=E4=BB=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/handle/impl/text_split_handle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/handle/impl/text_split_handle.py b/apps/common/handle/impl/text_split_handle.py index d40220638..56e36f93b 100644 --- a/apps/common/handle/impl/text_split_handle.py +++ b/apps/common/handle/impl/text_split_handle.py @@ -29,7 +29,8 @@ class TextSplitHandle(BaseSplitHandle): if file_name.endswith(".md") or file_name.endswith('.txt'): return True result = detect(buffer) - if result['encoding'] != 'ascii' and result['confidence'] > 0.5: + if result['encoding'] is not None and result['confidence'] is not None and result['encoding'] != 'ascii' and \ + result['confidence'] > 0.5: return True return False