This commit is contained in:
Scott E. Graves 2024-12-02 13:54:02 -06:00
parent 44d810c398
commit 3814b9797d

View File

@ -417,27 +417,29 @@ auto s3_provider::get_directory_items_impl(const std::string &api_path,
for (auto &&node : node_list) { for (auto &&node : node_list) {
auto child_object_name = utils::path::create_api_path( auto child_object_name = utils::path::create_api_path(
node.node().select_node("Key").node().text().as_string()); node.node().select_node("Key").node().text().as_string());
if (child_object_name != utils::path::create_api_path(prefix)) { if (child_object_name == utils::path::create_api_path(prefix)) {
continue;
}
auto size = node.node().select_node("Size").node().text().as_ullong(); auto size = node.node().select_node("Size").node().text().as_ullong();
auto last_modified = convert_api_date( auto last_modified = convert_api_date(
node.node().select_node("LastModified").node().text().as_string()); node.node().select_node("LastModified").node().text().as_string());
add_directory_item( add_directory_item(false, child_object_name, last_modified,
false, child_object_name, last_modified, [this, &is_encrypted, &size](
[this, &is_encrypted, const directory_item &dir_item) -> std::uint64_t {
&size](const directory_item &dir_item) -> std::uint64_t {
std::string size_str; std::string size_str;
if (get_item_meta(dir_item.api_path, META_SIZE, size_str) == if (get_item_meta(dir_item.api_path, META_SIZE,
api_error::success) { size_str) == api_error::success) {
return utils::string::to_uint64(size_str); return utils::string::to_uint64(size_str);
} }
return is_encrypted ? utils::encryption::encrypting_reader:: return is_encrypted
? utils::encryption::encrypting_reader::
calculate_decrypted_size(size) calculate_decrypted_size(size)
: size; : size;
}); });
} }
} }
}
return ret; return ret;
} }
@ -521,7 +523,10 @@ auto s3_provider::get_file_list(api_file_list &list, std::string &marker) const
for (auto &&node : node_list) { for (auto &&node : node_list) {
auto api_path = auto api_path =
std::string{node.node().select_node("Key").node().text().as_string()}; std::string{node.node().select_node("Key").node().text().as_string()};
if (not utils::string::ends_with(api_path, "/")) { if (utils::string::ends_with(api_path, "/")) {
continue;
}
auto is_encrypted = auto is_encrypted =
not get_config().get_s3_config().encryption_token.empty(); not get_config().get_s3_config().encryption_token.empty();
if (is_encrypted) { if (is_encrypted) {
@ -537,11 +542,8 @@ auto s3_provider::get_file_list(api_file_list &list, std::string &marker) const
file.api_path = utils::path::create_api_path(api_path); file.api_path = utils::path::create_api_path(api_path);
file.api_parent = utils::path::get_parent_api_path(file.api_path); file.api_parent = utils::path::get_parent_api_path(file.api_path);
file.accessed_date = file.changed_date = file.creation_date = file.accessed_date = file.changed_date = file.creation_date =
file.modified_date = convert_api_date(node.node() file.modified_date = convert_api_date(
.select_node("LastModified") node.node().select_node("LastModified").node().text().as_string());
.node()
.text()
.as_string());
file.file_size = file.file_size =
is_encrypted is_encrypted
? utils::encryption::encrypting_reader::calculate_decrypted_size( ? utils::encryption::encrypting_reader::calculate_decrypted_size(
@ -555,7 +557,6 @@ auto s3_provider::get_file_list(api_file_list &list, std::string &marker) const
list.push_back(std::move(file)); list.push_back(std::move(file));
} }
}
return grab_more ? api_error::more_data : api_error::success; return grab_more ? api_error::more_data : api_error::success;
} }