From ee9f8fc0284aa31fc0a4d1fbfc06724f2795b2aa Mon Sep 17 00:00:00 2001 From: Connor Nelson Date: Fri, 26 Apr 2024 15:24:37 -0700 Subject: [PATCH] Dojo: Support static file page --- dojo_plugin/pages/dojo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dojo_plugin/pages/dojo.py b/dojo_plugin/pages/dojo.py index 4733532db..65c8686e0 100644 --- a/dojo_plugin/pages/dojo.py +++ b/dojo_plugin/pages/dojo.py @@ -119,7 +119,11 @@ def view_module(dojo, module): def view_page(dojo, page): - if (dojo.path / f"{page}.md").is_file(): + if (dojo.path / page).is_file(): + path = (dojo.path / page).resolve() + return send_file(path) + + elif (dojo.path / f"{page}.md").is_file(): content = render_markdown((dojo.path / f"{page}.md").read_text()) return render_template("markdown.html", dojo=dojo, content=content) @@ -127,7 +131,7 @@ def view_page(dojo, page): user = get_current_user() if user and (dojo.path / page / f"{user.id}").is_file(): path = (dojo.path / page / f"{user.id}").resolve() - return send_file(path, as_attachment=True) + return send_file(path) elif user and (dojo.path / page / f"{user.id}.md").is_file(): content = render_markdown((dojo.path / page / f"{user.id}.md").read_text()) return render_template("markdown.html", dojo=dojo, content=content)