From d873c72bfa72b0b5dcd9c3d8e96f3422bc4bacfc Mon Sep 17 00:00:00 2001 From: ali <117142933+muhammad-ali-e@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:36:04 +0530 Subject: [PATCH] [MERGE-WITH-SDK-ROLL-RC6] updated logic for getting mimetype according to the sdk changes (#884) updated logic for getting mimetype according to the sdk changes Co-authored-by: Gayathri <142381512+gaya3-zipstack@users.noreply.github.com> --- backend/workflow_manager/endpoint_v2/destination.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/workflow_manager/endpoint_v2/destination.py b/backend/workflow_manager/endpoint_v2/destination.py index 2375cf801..627b254c9 100644 --- a/backend/workflow_manager/endpoint_v2/destination.py +++ b/backend/workflow_manager/endpoint_v2/destination.py @@ -10,6 +10,7 @@ from connector_v2.models import ConnectorInstance from fsspec.implementations.local import LocalFileSystem from unstract.sdk.constants import ToolExecKey +from unstract.sdk.file_storage.constants import FileOperationParams from unstract.sdk.tool.mime_types import EXT_MIME_MAP from unstract.workflow_execution.constants import ToolOutputType from utils.user_context import UserContext @@ -457,7 +458,9 @@ def get_result_with_file_storage( file_storage = file_system.get_file_storage() try: # TODO: SDK handles validation; consider removing here. - file_type = file_storage.mime_type(output_file) + file_type = file_storage.mime_type( + path=output_file, read_length=FileOperationParams.READ_ENTIRE_LENGTH + ) if output_type == ToolOutputType.JSON: if file_type != EXT_MIME_MAP[ToolOutputType.JSON.lower()]: logger.error(f"Output type json mismatched {file_type}")