From c67e072ff552890f9be60eb824aff7fd87a89c14 Mon Sep 17 00:00:00 2001 From: Normann Date: Wed, 1 Apr 2026 19:34:37 +0200 Subject: [PATCH] Refactor EOS redirect logic for cleaner URL handling --- src/akkudoktoreos/server/eos.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/akkudoktoreos/server/eos.py b/src/akkudoktoreos/server/eos.py index c5c83f2..d58a827 100755 --- a/src/akkudoktoreos/server/eos.py +++ b/src/akkudoktoreos/server/eos.py @@ -1511,18 +1511,9 @@ Did you want to connect to EOSdash? # Use IP of EOS host host = get_host_ip() if host and get_config().server.eosdash_port: - # Redirect to EOSdash server using a sanitized relative path - safe_path = _sanitize_redirect_path(path) - if safe_path is None: - # Unsafe path; fall back to EOSdash root - safe_path = "" base_url = f"http://{host}:{get_config().server.eosdash_port}" - # Ensure exactly one slash between base_url and path - if safe_path: - url = f"{base_url}/{safe_path}" - else: - url = f"{base_url}/" - return RedirectResponse(url=url, status_code=303) + safe_path = _sanitize_redirect_path(path) or "" + url = f"{base_url}/{safe_path}" # Redirect the root URL to the site map return RedirectResponse(url="/docs", status_code=303)