prthm11 commited on
Commit
7886287
·
verified ·
1 Parent(s): 92c91c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2298,13 +2298,13 @@ def download_sb3(project_id):
2298
  @app.route("/download_pdf/<project_id>", methods=["GET"])
2299
  def download_pdf(project_id):
2300
  pdf_path = GEN_PROJECT_DIR / f"{project_id}.pdf"
2301
- if not pdf_doc.exists():
2302
  return jsonify({"error": "Scratch project file not found"}), 404
2303
 
2304
  return send_file(
2305
- pdf_doc,
2306
  as_attachment=True,
2307
- download_name=pdf_doc.name
2308
  )
2309
 
2310
  # API endpoint
 
2298
  @app.route("/download_pdf/<project_id>", methods=["GET"])
2299
  def download_pdf(project_id):
2300
  pdf_path = GEN_PROJECT_DIR / f"{project_id}.pdf"
2301
+ if not pdf_path.exists():
2302
  return jsonify({"error": "Scratch project file not found"}), 404
2303
 
2304
  return send_file(
2305
+ pdf_path,
2306
  as_attachment=True,
2307
+ download_name=pdf_path.name
2308
  )
2309
 
2310
  # API endpoint