From feab26093cddac788af14c70839a3ed97f4310b9 Mon Sep 17 00:00:00 2001 From: Anthony Donlon Date: Tue, 16 Dec 2025 20:38:47 +0800 Subject: [PATCH] miscellaneous fixes --- editor/server/editor.py | 2 +- editor/server/examples.py | 1 - editor/web/index.html | 6 +++--- editor/web/src/index.js | 7 +++++-- examples/catastrophic.json | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/editor/server/editor.py b/editor/server/editor.py index 5625c99..e478e72 100644 --- a/editor/server/editor.py +++ b/editor/server/editor.py @@ -8,7 +8,7 @@ from flask import ( ) root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../') -res_folder = os.path.join(root_dir, 'editor/frontend/dist') +res_folder = os.path.join(root_dir, 'editor/web/dist') bp = Blueprint('editor', __name__, url_prefix='/') diff --git a/editor/server/examples.py b/editor/server/examples.py index e98c41e..a16b9e9 100644 --- a/editor/server/examples.py +++ b/editor/server/examples.py @@ -39,7 +39,6 @@ def get_page_params(name: str) -> dict: @bp.route('/', defaults={'name': 'default'}) @bp.route('/') def index(name: str): - name = os.path.basename(name) # keep only the base name lower_name = name.lower() if name != lower_name: return redirect(lower_name) diff --git a/editor/web/index.html b/editor/web/index.html index db97bb8..7d85013 100644 --- a/editor/web/index.html +++ b/editor/web/index.html @@ -11,7 +11,7 @@ Cloudflare Error Page Editor - + @@ -19,12 +19,12 @@ - + - + diff --git a/editor/web/src/index.js b/editor/web/src/index.js index 861be36..2cb9d26 100644 --- a/editor/web/src/index.js +++ b/editor/web/src/index.js @@ -53,7 +53,7 @@ const PRESETS = { title: 'Catastrophic infrastructure failure', error_code: '500', more_information: { - for: 'no information', + for: 'no help at all', }, browser_status: { status: 'error', @@ -136,7 +136,10 @@ function getDefaultPresetName() { const key = 'from'; let name = extractUrlParam(window.location.search, key); if (!name) { - name = extractUrlParam(window.location.hash.substr(1), key); + name = extractUrlParam(window.location.hash.substring(1), key); + } + if (name) { + name = name.replace(/[^\w\d]/g, '') } return name; } diff --git a/examples/catastrophic.json b/examples/catastrophic.json index 3261939..320f1da 100644 --- a/examples/catastrophic.json +++ b/examples/catastrophic.json @@ -1,7 +1,7 @@ { "title": "Catastrophic infrastructure failure", "more_information": { - "for": "no information" + "for": "no help at all" }, "browser_status": { "status": "error",