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:
parent
2043594670
commit
c55dd02196
1 changed files with 2 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ async def upload_session(
|
||||||
if len(content) > MAX_UPLOAD_SIZE:
|
if len(content) > MAX_UPLOAD_SIZE:
|
||||||
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
|
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
|
||||||
target.write_bytes(content)
|
target.write_bytes(content)
|
||||||
return {"status": "ok", "path": str(target), "size": len(content)}
|
return {"status": "ok", "filename": filename, "size": len(content)}
|
||||||
|
|
||||||
|
|
||||||
@router.post("/artifacts")
|
@router.post("/artifacts")
|
||||||
|
|
@ -56,7 +56,7 @@ async def upload_artifact(
|
||||||
if len(content) > MAX_UPLOAD_SIZE:
|
if len(content) > MAX_UPLOAD_SIZE:
|
||||||
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
|
raise HTTPException(status_code=413, detail=f"File too large (max {MAX_UPLOAD_SIZE // 1024 // 1024}MB)")
|
||||||
target.write_bytes(content)
|
target.write_bytes(content)
|
||||||
return {"status": "ok", "path": str(target), "size": len(content)}
|
return {"status": "ok", "filename": filename, "size": len(content)}
|
||||||
|
|
||||||
|
|
||||||
class LocalMdRequest(BaseModel):
|
class LocalMdRequest(BaseModel):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue