Spaces:
Running
Running
Update app.py
Browse files
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
|
2302 |
return jsonify({"error": "Scratch project file not found"}), 404
|
2303 |
|
2304 |
return send_file(
|
2305 |
-
|
2306 |
as_attachment=True,
|
2307 |
-
download_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
|