From 4b3f7365cf45ebdd9fb70d8d2bc8f6bef6f56fe7 Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Thu, 13 Aug 2026 13:00:52 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20404=20on=20/=3Fkey=3D=E2=80=A6=20(route?= =?UTF-8?q?=20matching=20must=20strip=20the=20query=20string)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/editor.py b/editor.py index 41fa1b4..10a0d53 100644 --- a/editor.py +++ b/editor.py @@ -29,6 +29,7 @@ import time import uuid from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path +from urllib.parse import urlparse # -------------------------------------------------------------------------- # Config @@ -212,10 +213,11 @@ class Handler(BaseHTTPRequestHandler): # -- routes ----------------------------------------------------------- def do_GET(self): - if self.path in ("/", "/index.html"): + path = urlparse(self.path).path # strip ?query so /?key=… still routes + if path in ("/", "/index.html"): self._send(200, PAGE.encode(), "text/html; charset=utf-8") return - if self.path == "/file": + if path == "/file": if not self._authorized(): self._json(401, {"error": "token required"}) return @@ -228,7 +230,7 @@ class Handler(BaseHTTPRequestHandler): "head": git_head(), "repo": str(REPO), "sections": parse_sections(content)}) return - if self.path.startswith("/job/"): + if path.startswith("/job/"): if not self._authorized(): self._json(401, {"error": "token required"}) return