Avinashnalla7 commited on
Commit
581704a
·
1 Parent(s): 2fc7c46

cleanup: remove dead code after /api/pdf return

Browse files
Files changed (1) hide show
  1. backend/api.py +0 -22
backend/api.py CHANGED
@@ -125,30 +125,8 @@ def get_pdf(pdf_id: str):
125
  # Return raw bytes
126
  from fastapi.responses import Response
127
  return Response(content=data, media_type="application/pdf")
128
-
129
- # Stream bytes back to UI
130
- resp = PlainTextResponse(content=data)
131
- resp.media_type = "application/pdf"
132
- resp.headers["X-PDF-Name"] = f"{pdf_id}.pdf"
133
- return resp
134
-
135
- remote_rel = f"pdfs/{pdf_id}.pdf"
136
- if not store.exists(remote_rel):
137
- raise HTTPException(status_code=404, detail="PDF not found")
138
- data = store.get_bytes(remote_rel)
139
-
140
- # Return bytes directly (no local disk dependency)
141
- from fastapi.responses import Response
142
  return Response(content=data, media_type="application/pdf")
143
 
144
-
145
- return FileResponse(
146
- path=pdf_path,
147
- media_type="application/pdf",
148
- filename=pdf_id,
149
- )
150
-
151
-
152
  @app.post("/api/send-config")
153
  def send_config(payload: Dict[str, Any]):
154
  # Expect payload to include at least: pdf_id, template_id, config
 
125
  # Return raw bytes
126
  from fastapi.responses import Response
127
  return Response(content=data, media_type="application/pdf")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  return Response(content=data, media_type="application/pdf")
129
 
 
 
 
 
 
 
 
 
130
  @app.post("/api/send-config")
131
  def send_config(payload: Dict[str, Any]):
132
  # Expect payload to include at least: pdf_id, template_id, config