From 775ab301f6a49b1e50c37a279660c5eb40a0d3b8 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 1 Apr 2026 13:50:17 +0000 Subject: [PATCH] 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) --- hosts/ocaml/bin/sx_server.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 193394de..18997bbd 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -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