Skip to content

Commit

Permalink
admin: fix some incorrect stoi usages
Browse files Browse the repository at this point in the history
CONFLICTS:
- uses [] instead of get_param

- get_integer_query_param() returns a uint64_t
- revision ids are int64_t

(cherry picked from commit a6fcac5)
  • Loading branch information
andrwng committed Jun 3, 2024
1 parent 25f30c8 commit 66251be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/v/redpanda/admin_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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"]));
Expand Down

0 comments on commit 66251be

Please sign in to comment.