From 788ecaa6828026229df2b78245991dffcaac1271 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 25 Mar 2026 15:05:56 +0300 Subject: [PATCH] api: Fix enable_injection to accept case-insensitive bool parameter Replace strict case-sensitive '== "True"' check with strcasecmp(..., "true") so that Python's str(True) -> "True" is properly recognized. Accepts any case variation of "true" ("True", "TRUE", etc.), with empty string defaulting to false. Maintains backward compatibility with out-of-tree tests that rely on Python's bool stringification. The goal is to reduce the number of distinct ways API handlers use to convert string http query parameters into bool variables. This place is the only one that simply compares param to "True". Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Closes scylladb/scylladb#29236 --- api/error_injection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/error_injection.cc b/api/error_injection.cc index 62fd13fcbe..8164273dd5 100644 --- a/api/error_injection.cc +++ b/api/error_injection.cc @@ -23,7 +23,7 @@ void set_error_injection(http_context& ctx, routes& r) { hf::enable_injection.set(r, [](std::unique_ptr req) -> future { sstring injection = req->get_path_param("injection"); - bool one_shot = req->get_query_param("one_shot") == "True"; + bool one_shot = strcasecmp(req->get_query_param("one_shot").c_str(), "true") == 0; auto params = co_await util::read_entire_stream_contiguous(*req->content_stream); const size_t max_params_size = 1024 * 1024;