fix
This commit is contained in:
@ -887,20 +887,18 @@ void s3_provider::stop() {
|
|||||||
auto s3_provider::upload_file_impl(const std::string &api_path,
|
auto s3_provider::upload_file_impl(const std::string &api_path,
|
||||||
const std::string &source_path,
|
const std::string &source_path,
|
||||||
stop_type &stop_requested) -> api_error {
|
stop_type &stop_requested) -> api_error {
|
||||||
|
std::uint64_t file_size{};
|
||||||
auto file = utils::file::file{source_path};
|
auto file = utils::file::file{source_path};
|
||||||
if (not file.exists()) {
|
if (file.exists()) {
|
||||||
return api_error::comm_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto opt_size = file.size();
|
auto opt_size = file.size();
|
||||||
if (not opt_size.has_value()) {
|
if (not opt_size.has_value()) {
|
||||||
return api_error::comm_error;
|
return api_error::comm_error;
|
||||||
}
|
}
|
||||||
|
file_size = opt_size.value();
|
||||||
|
}
|
||||||
|
|
||||||
auto file_size{opt_size.value()};
|
auto cfg = get_config().get_s3_config();
|
||||||
|
auto is_encrypted = not cfg.encryption_token.empty();
|
||||||
const auto cfg = get_config().get_s3_config();
|
|
||||||
const auto is_encrypted = not cfg.encryption_token.empty();
|
|
||||||
|
|
||||||
std::string key;
|
std::string key;
|
||||||
if (is_encrypted) {
|
if (is_encrypted) {
|
||||||
@ -910,7 +908,7 @@ auto s3_provider::upload_file_impl(const std::string &api_path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto object_name =
|
auto object_name =
|
||||||
utils::path::create_api_path(is_encrypted ? key : api_path);
|
utils::path::create_api_path(is_encrypted ? key : api_path);
|
||||||
|
|
||||||
curl::requests::http_put_file put_file{};
|
curl::requests::http_put_file put_file{};
|
||||||
|
Reference in New Issue
Block a user