From 6c7bff7c7af214cbb735713bf11a06ad6500c193 Mon Sep 17 00:00:00 2001 From: shenghong96 Date: Mon, 30 Nov 2020 10:45:40 +0800 Subject: [PATCH] redirect the graphvizlib.wasm file to make firefox browser access the computed graph properly --- .../backend/datavisual/static_resource_api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mindinsight/backend/datavisual/static_resource_api.py b/mindinsight/backend/datavisual/static_resource_api.py index 7ce0ccee..ab3ed628 100644 --- a/mindinsight/backend/datavisual/static_resource_api.py +++ b/mindinsight/backend/datavisual/static_resource_api.py @@ -18,6 +18,7 @@ import sys from flask import current_app from flask import make_response +from flask import redirect from flask import Blueprint from mindinsight.conf import settings @@ -36,6 +37,18 @@ def index(): return make_response(html_content) +@BLUEPRINT.route("/graphvizlib.wasm", methods=["GET"]) +def return_wasm_file(): + """ + Interface to redirect graphvizlib.wasm + + When accessing the graphvizlib.wasm file in front module via Firefox browser, the file path will change to + "/graphvizlib.wasm" which makes the computed diagram inaccessible. Redirecting the path to correct address can + ensure the computed graph accessible properly. + """ + return redirect(location="static/js/graphvizlib.wasm") + + def init_module(app): """ Init module entry.