fix: stop leaking server file paths in upload responses

Return filename instead of full server-side path in upload_session
and upload_artifact responses.
This commit is contained in:
ZdenekSrotyr 2026-04-09 16:31:46 +02:00
parent 2043594670
commit c55dd02196

View file

@ -34,7 +34,7 @@ async def upload_session(
if len(content) > MAX_UPLOAD_SIZE:
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
target.write_bytes(content)
return {"status": "ok", "path": str(target), "size": len(content)}
return {"status": "ok", "filename": filename, "size": len(content)}
@router.post("/artifacts")
@ -56,7 +56,7 @@ async def upload_artifact(
if len(content) > MAX_UPLOAD_SIZE:
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
target.write_bytes(content)
return {"status": "ok", "path": str(target), "size": len(content)}
return {"status": "ok", "filename": filename, "size": len(content)}
class LocalMdRequest(BaseModel):