mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-28 05:42:51 +00:00
feat: enhance error logging for file processing in CSV, XLS, and DOC handlers
This commit is contained in:
parent
82a2203be6
commit
0f1d57f0cb
|
|
@ -34,6 +34,8 @@ class CsvSplitHandle(BaseSplitHandle):
|
|||
file_name = os.path.basename(file.name)
|
||||
result = {'name': file_name, 'content': paragraphs}
|
||||
try:
|
||||
if type(limit) is str:
|
||||
limit = int(limit)
|
||||
reader = csv.reader(io.TextIOWrapper(io.BytesIO(buffer), encoding=detect(buffer)['encoding']))
|
||||
try:
|
||||
title_row_list = reader.__next__()
|
||||
|
|
|
|||
|
|
@ -195,6 +195,8 @@ class DocSplitHandle(BaseSplitHandle):
|
|||
def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image):
|
||||
file_name = os.path.basename(file.name)
|
||||
try:
|
||||
if type(limit) is str:
|
||||
limit = int(limit)
|
||||
image_list = []
|
||||
buffer = get_buffer(file)
|
||||
doc = Document(io.BytesIO(buffer))
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ class HTMLSplitHandle(BaseSplitHandle):
|
|||
|
||||
def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image):
|
||||
buffer = get_buffer(file)
|
||||
|
||||
if type(limit) is str:
|
||||
limit = int(limit)
|
||||
if pattern_list is not None and len(pattern_list) > 0:
|
||||
split_model = SplitModel(pattern_list, with_filter, limit)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ class TextSplitHandle(BaseSplitHandle):
|
|||
|
||||
def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image):
|
||||
buffer = get_buffer(file)
|
||||
if type(limit) is str:
|
||||
limit = int(limit)
|
||||
if pattern_list is not None and len(pattern_list) > 0:
|
||||
split_model = SplitModel(pattern_list, with_filter, limit)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue