From 66251be33ae4c889c54be93cbbb16b1e555bf135 Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Thu, 30 May 2024 19:14:02 -0700 Subject: [PATCH] admin: fix some incorrect stoi usages CONFLICTS: - uses [] instead of get_param - get_integer_query_param() returns a uint64_t - revision ids are int64_t (cherry picked from commit a6fcac50af50e76140ff102192871074e627fba9) --- src/v/redpanda/admin_server.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/v/redpanda/admin_server.cc b/src/v/redpanda/admin_server.cc index 1839365f697e5..6118b57f426d1 100644 --- a/src/v/redpanda/admin_server.cc +++ b/src/v/redpanda/admin_server.cc @@ -482,7 +482,7 @@ get_integer_query_param(const ss::http::request& req, std::string_view name) { const ss::sstring& str_param = req.query_parameters.at(key); try { - return std::stoi(str_param); + return std::stoull(str_param); } catch (const std::invalid_argument&) { throw ss::httpd::bad_request_exception( fmt::format("Parameter {} must be an integer", name)); @@ -5194,7 +5194,7 @@ admin_server::delete_cloud_storage_lifecycle( model::initial_revision_id revision; try { revision = model::initial_revision_id( - std::stoi(req->param["revision"])); + std::stoll(req->param["revision"])); } catch (...) { throw ss::httpd::bad_param_exception(fmt::format( "Revision id must be an integer: {}", req->param["revision"]));