Skip to content

Commit 1a76d34

Browse files
amanapetofarr
andauthored
Fix FastAPI path parameters to handle file paths with forward slashes (#848)
Co-authored-by: Tim O'Farrell <[email protected]>
1 parent 7b4250b commit 1a76d34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openhands-agent-server/openhands/agent_server/file_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
config = get_default_config()
2222

2323

24-
@file_router.post("/upload/{path}")
24+
@file_router.post("/upload/{path:path}")
2525
async def upload_file(
2626
path: Annotated[str, FastApiPath(alias="path", description="Absolute file path.")],
2727
file: UploadFile = File(...),
@@ -54,7 +54,7 @@ async def upload_file(
5454
)
5555

5656

57-
@file_router.get("/download/{path}")
57+
@file_router.get("/download/{path:path}")
5858
async def download_file(
5959
path: Annotated[str, FastApiPath(description="Absolute file path.")],
6060
) -> FileResponse:

0 commit comments

Comments
 (0)