Skip to content

Commit

Permalink
cloud_storage: fix s3 request parameters
Browse files Browse the repository at this point in the history
In `ListObjectsV2` for the `s3_client`, `prefix`, `delimiter`,
`start_after`, and `continuation-token` are all URI parameters,
not request headers.
  • Loading branch information
WillemKauf committed May 7, 2024
1 parent eae9f43 commit 15e3ec6
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/v/cloud_storage_clients/s3_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,18 @@ request_creator::make_list_objects_v2_request(
if (prefix.has_value()) {
key = fmt::format("{}&prefix={}", key, (*prefix)().string());
}
if (delimiter.has_value()) {
key = fmt::format("{}&delimiter={}", key, *delimiter);
if (start_after.has_value()) {
key = fmt::format("{}&start-after={}", key, *start_after);
}
if (max_keys.has_value()) {
key = fmt::format("{}&max-keys={}", key, *max_keys);
}
if (continuation_token.has_value()) {
key = fmt::format("{}&continuation-token={}", key, *continuation_token);
}
if (delimiter.has_value()) {
key = fmt::format("{}&delimiter={}", key, *delimiter);
}
auto target = make_target(name, object_key{key});
header.method(boost::beast::http::verb::get);
header.target(target);
Expand All @@ -217,23 +223,6 @@ request_creator::make_list_objects_v2_request(
header.insert(boost::beast::http::field::host, host);
header.insert(boost::beast::http::field::content_length, "0");

if (prefix) {
header.insert(aws_header_names::prefix, (*prefix)().string());
}
if (start_after) {
header.insert(aws_header_names::start_after, (*start_after)().string());
}
if (continuation_token) {
header.insert(
aws_header_names::continuation_token,
{continuation_token->data(), continuation_token->size()});
}

if (delimiter) {
header.insert(
aws_header_names::delimiter, std::string(1, delimiter.value()));
}

auto ec = _apply_credentials->add_auth(header);
vlog(s3_log.trace, "ListObjectsV2:\n {}", header);
if (ec) {
Expand Down

0 comments on commit 15e3ec6

Please sign in to comment.