[bug] Incorrect file size displayed while upload is pending #23

This commit is contained in:
Scott E. Graves 2024-12-02 11:10:40 -06:00
parent 86f910c865
commit 29615d61eb

View File

@ -425,7 +425,7 @@ auto s3_provider::get_directory_items_impl(const std::string &api_path,
false, child_object_name, last_modified,
[this, &is_encrypted,
&size](const directory_item &dir_item) -> std::uint64_t {
std::string size_str{};
std::string size_str;
auto res = get_item_meta(dir_item.api_path, META_SIZE, size_str);
if (res == api_error::success) {
return utils::string::to_uint64(size_str);
@ -466,6 +466,13 @@ auto s3_provider::get_file(const std::string &api_path, api_file &file) const
result.content_length)
: result.content_length;
file.key = is_encrypted ? utils::path::create_api_path(api_path) : "";
std::string size_str;
auto res = get_item_meta(file.api_path, META_SIZE, size_str);
if (res == api_error::success) {
file.file_size = utils::string::to_uint64(size_str);
}
return add_if_not_found(file, object_name);
} catch (const std::exception &e) {
utils::error::raise_error(function_name, e, "exception occurred");