From f8b66a14bb66479a007ce037fb2b74f8d5234fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Langdorph?= Date: Tue, 19 May 2026 13:57:20 +0200 Subject: [PATCH] fix AsyncSandboxFilesystem.upload_file missing await AsyncSandboxFilesystem.upload_file did not await the write_file call (because it's just wrapped as async). --- koyeb/sandbox/filesystem.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/koyeb/sandbox/filesystem.py b/koyeb/sandbox/filesystem.py index 25998044..b6db888f 100644 --- a/koyeb/sandbox/filesystem.py +++ b/koyeb/sandbox/filesystem.py @@ -10,6 +10,7 @@ import os from dataclasses import dataclass from typing import TYPE_CHECKING, Dict, List, Union +import asyncio from .executor_client import SandboxClient from .utils import ( @@ -572,7 +573,6 @@ async def is_dir(self, path: str) -> bool: """Check if path is a directory asynchronously""" pass - @async_wrapper("upload_file") async def upload_file( self, local_path: str, remote_path: str, encoding: str = "utf-8" ) -> None: @@ -584,7 +584,15 @@ async def upload_file( remote_path: Destination path in the sandbox encoding: File encoding (default: "utf-8"). Use "base64" for binary files. """ - pass + if not os.path.exists(local_path): + raise SandboxFileNotFoundError(f"Local file not found: {local_path}") + + def _read(): + with open(local_path, "rb") as f: + return f.read() + + content_bytes = await asyncio.to_thread(_read) + await self.write_file(remote_path, content_bytes, encoding=encoding) @async_wrapper("download_file") async def download_file(