Fix debug endpoint: use raw_path to preserve query string

The query string was stripped from path for routing but the debug
endpoint needs it to parse ?expr= and ?name= params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 13:50:17 +00:00
parent 86c67e5955
commit 775ab301f6

View File

@@ -2522,8 +2522,9 @@ let http_mode port =
write_response fd (http_redirect "/sx/"); true
end else
(* Debug endpoint — runs on main thread, no render worker *)
let raw_decoded = url_decode raw_path in
if String.length path > 11 && String.sub path 0 11 = "/sx/_debug/" then begin
let cmd = String.sub path 11 (String.length path - 11) in
let cmd = String.sub raw_decoded 11 (String.length raw_decoded - 11) in
let query_start = try String.index cmd '?' with Not_found -> String.length cmd in
let action = String.sub cmd 0 query_start in
let query = if query_start < String.length cmd - 1