From 8e7d8d66156b10349c92b712b6e049113ab3c32d Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 9 Dec 2025 10:38:26 +0800 Subject: [PATCH] feat: decode base64 file chunks before uploading --- .../step_node/tool_lib_node/impl/base_tool_lib_node.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py b/apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py index 90fefb86c..67941666b 100644 --- a/apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py +++ b/apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py @@ -8,6 +8,7 @@ """ import ast +import base64 import io import json import mimetypes @@ -207,9 +208,13 @@ class BaseToolLibNodeNode(IToolLibNode): {**all_params, **self.workflow_params.get('data_source'), 'download_item': item}, function_name='download') - file = bytes_to_uploaded_file(ast.literal_eval(result.get('file_bytes')), result.get('name')) + file_bytes = result.get('file_bytes', []) + chunks = [] + for chunk in file_bytes: + chunks.append(base64.b64decode(chunk)) + file = bytes_to_uploaded_file(b''.join(chunks), result.get('name')) file_url = self.upload_knowledge_file(file) - download_file_list.append({'file_id': file_url, 'name': result.get('name')}) + download_file_list.append({'file_id': file_url.split('/')[-1], 'name': result.get('name')}) result = download_file_list else: result = function_executor.exec_code(tool_lib.code, all_params)