diff --git a/src/BowongModalFunctions/router/cache.py b/src/BowongModalFunctions/router/cache.py index a1aad50..f2adddd 100644 --- a/src/BowongModalFunctions/router/cache.py +++ b/src/BowongModalFunctions/router/cache.py @@ -13,6 +13,7 @@ from fastapi.responses import JSONResponse, RedirectResponse from starlette import status import boto3 from botocore.config import Config +from typing_inspection.typing_objects import target from ..config import WorkerConfig from ..middleware.authorization import verify_token @@ -235,6 +236,8 @@ async def s3_copy(body: ClusterCacheBatchRequest) -> ClusterCacheBatchResponse: results: List[CacheTaskResult] = [] for task in body.tasks: try: + if task.target: + os.makedirs(os.path.dirname(task.target.local_mount_path), exist_ok=True) match task.type: case CacheOperationType.copy: shutil.copy(task.source.local_mount_path, task.target.local_mount_path)