From 45506c868eecc79f1d787852232d2462c30c0999 Mon Sep 17 00:00:00 2001 From: km0 Date: Wed, 1 Mar 2023 15:19:18 +0100 Subject: [PATCH] img sanitizer --- readme.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/readme.py b/readme.py index 3d54f68..67543d6 100644 --- a/readme.py +++ b/readme.py @@ -30,7 +30,7 @@ def render(): for entry in index: with open(os.path.join("contents", entry)) as e: html = markdown( - e.read(), + e.read().replace("../img", "img"), extensions=[ "markdown.extensions.attr_list", "markdown.extensions.codehilite", @@ -55,6 +55,11 @@ def home(): return send_from_directory(app.root_path, "index.html") +@app.route("/img/") +def send_image(filename): + return send_from_directory(os.path.join(app.root_path, "contents", "img"), filename) + + @app.route("/update", methods=["GET", "POST"]) def update(): if request.method == "POST":