diff --git a/autogpt_platform/backend/backend/blocks/google/gmail.py b/autogpt_platform/backend/backend/blocks/google/gmail.py index 8f3d9dd615..2040cabe3f 100644 --- a/autogpt_platform/backend/backend/blocks/google/gmail.py +++ b/autogpt_platform/backend/backend/blocks/google/gmail.py @@ -121,9 +121,8 @@ async def create_mime_message( execution_context=execution_context, return_format="for_local_processing", ) - abs_path = get_exec_file_path( - execution_context.graph_exec_id or "", local_path - ) + assert execution_context.graph_exec_id # Validated by store_media_file + abs_path = get_exec_file_path(execution_context.graph_exec_id, local_path) part = MIMEBase("application", "octet-stream") with open(abs_path, "rb") as f: part.set_payload(f.read()) @@ -1191,7 +1190,8 @@ async def _build_reply_message( execution_context=execution_context, return_format="for_local_processing", ) - abs_path = get_exec_file_path(execution_context.graph_exec_id or "", local_path) + assert execution_context.graph_exec_id # Validated by store_media_file + abs_path = get_exec_file_path(execution_context.graph_exec_id, local_path) part = MIMEBase("application", "octet-stream") with open(abs_path, "rb") as f: part.set_payload(f.read()) @@ -1721,9 +1721,8 @@ To: {original_to} execution_context=execution_context, return_format="for_local_processing", ) - abs_path = get_exec_file_path( - execution_context.graph_exec_id or "", local_path - ) + assert execution_context.graph_exec_id # Validated by store_media_file + abs_path = get_exec_file_path(execution_context.graph_exec_id, local_path) part = MIMEBase("application", "octet-stream") with open(abs_path, "rb") as f: part.set_payload(f.read()) diff --git a/autogpt_platform/backend/backend/blocks/spreadsheet.py b/autogpt_platform/backend/backend/blocks/spreadsheet.py index 6388172561..a13f9e2f6d 100644 --- a/autogpt_platform/backend/backend/blocks/spreadsheet.py +++ b/autogpt_platform/backend/backend/blocks/spreadsheet.py @@ -113,8 +113,9 @@ class ReadSpreadsheetBlock(Block): ) # Get full file path + assert execution_context.graph_exec_id # Validated by store_media_file file_path = get_exec_file_path( - execution_context.graph_exec_id or "", stored_file_path + execution_context.graph_exec_id, stored_file_path ) if not Path(file_path).exists(): raise ValueError(f"File does not exist: {file_path}") diff --git a/autogpt_platform/backend/backend/blocks/text.py b/autogpt_platform/backend/backend/blocks/text.py index fa121a07e7..07807adb16 100644 --- a/autogpt_platform/backend/backend/blocks/text.py +++ b/autogpt_platform/backend/backend/blocks/text.py @@ -455,9 +455,8 @@ class FileReadBlock(Block): ) # Get full file path - file_path = get_exec_file_path( - execution_context.graph_exec_id or "", stored_file_path - ) + assert execution_context.graph_exec_id # Validated by store_media_file + file_path = get_exec_file_path(execution_context.graph_exec_id, stored_file_path) if not Path(file_path).exists(): raise ValueError(f"File does not exist: {file_path}")