Spaces:
Sleeping
Sleeping
Commit ·
ac909e8
1
Parent(s): 7808c70
Allow PUT /api/pdf as alias of POST
Browse files- backend/api.py +16 -0
backend/api.py
CHANGED
|
@@ -101,3 +101,19 @@ async def send_config(payload: Dict[str, Any]) -> Dict[str, Any]:
|
|
| 101 |
|
| 102 |
pdf_exists = (PDF_DIR / f"{pdf_id}.pdf").exists()
|
| 103 |
return {"ok": True, "stored": str(cfg_path), "pdf_exists": pdf_exists, "sftp": "not_implemented_here"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
pdf_exists = (PDF_DIR / f"{pdf_id}.pdf").exists()
|
| 103 |
return {"ok": True, "stored": str(cfg_path), "pdf_exists": pdf_exists, "sftp": "not_implemented_here"}
|
| 104 |
+
|
| 105 |
+
@app.put("/api/pdf/{pdf_id}")
|
| 106 |
+
async def put_pdf_alias(
|
| 107 |
+
pdf_id: str,
|
| 108 |
+
file: UploadFile = File(...),
|
| 109 |
+
pdf_name: str = Form("")
|
| 110 |
+
):
|
| 111 |
+
return await post_pdf(pdf_id=pdf_id, file=file, pdf_name=pdf_name)
|
| 112 |
+
|
| 113 |
+
@app.put("/api/pdf/{pdf_id}")
|
| 114 |
+
async def put_pdf_alias(
|
| 115 |
+
pdf_id: str,
|
| 116 |
+
file: UploadFile = File(...),
|
| 117 |
+
pdf_name: str = Form("")
|
| 118 |
+
):
|
| 119 |
+
return await post_pdf(pdf_id=pdf_id, file=file, pdf_name=pdf_name)
|