Skip to content

Commit 4c97568

Browse files
committed
chore: normalize with_filter parameter to boolean in split handle files
--bug=1057879 --user=刘瑞斌 【知识库】高级分段中自动清洗功能未生效 https://www.tapd.cn/62980211/s/1727744
1 parent fe78de5 commit 4c97568

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

apps/common/handle/impl/text/doc_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu
197197
try:
198198
if type(limit) is str:
199199
limit = int(limit)
200+
if type(with_filter) is str:
201+
with_filter = with_filter.lower() == 'true'
200202
image_list = []
201203
buffer = get_buffer(file)
202204
doc = Document(io.BytesIO(buffer))

apps/common/handle/impl/text/html_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu
4848
buffer = get_buffer(file)
4949
if type(limit) is str:
5050
limit = int(limit)
51+
if type(with_filter) is str:
52+
with_filter = with_filter.lower() == 'true'
5153
if pattern_list is not None and len(pattern_list) > 0:
5254
split_model = SplitModel(pattern_list, with_filter, limit)
5355
else:

apps/common/handle/impl/text/pdf_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu
5454
try:
5555
if type(limit) is str:
5656
limit = int(limit)
57+
if type(with_filter) is str:
58+
with_filter = with_filter.lower() == 'true'
5759
# 处理有目录的pdf
5860
result = self.handle_toc(pdf_document, limit)
5961
if result is not None:

apps/common/handle/impl/text/text_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu
4343
buffer = get_buffer(file)
4444
if type(limit) is str:
4545
limit = int(limit)
46+
if type(with_filter) is str:
47+
with_filter = with_filter.lower() == 'true'
4648
if pattern_list is not None and len(pattern_list) > 0:
4749
split_model = SplitModel(pattern_list, with_filter, limit)
4850
else:

apps/common/handle/impl/text/zip_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ class ZipSplitHandle(BaseSplitHandle):
121121
def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image):
122122
if type(limit) is str:
123123
limit = int(limit)
124+
if type(with_filter) is str:
125+
with_filter = with_filter.lower() == 'true'
124126
buffer = get_buffer(file)
125127
bytes_io = io.BytesIO(buffer)
126128
result = []

0 commit comments

Comments
 (0)