fix: 分段不支持类型的文件报错
This commit is contained in:
parent
c0d0f53baa
commit
8b31fd6b36
@ -29,7 +29,8 @@ class TextSplitHandle(BaseSplitHandle):
|
|||||||
if file_name.endswith(".md") or file_name.endswith('.txt'):
|
if file_name.endswith(".md") or file_name.endswith('.txt'):
|
||||||
return True
|
return True
|
||||||
result = detect(buffer)
|
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 True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user