This commit is contained in:
Scott E. Graves 2024-10-25 10:18:29 -05:00
parent f5b4928818
commit a77fd75687

View File

@ -58,7 +58,15 @@ auto http_put_file::set_method(CURL *curl, stop_type &stop_requested) const
return false; return false;
} }
auto file_size = read_info->file->size().value_or(0U); auto opt_size = read_info->file->size();
if (not opt_size.has_value()) {
utils::error::raise_url_error(
function_name, get_path(), source_path,
std::runtime_error("failed to get file size"));
return false;
}
auto file_size = opt_size.value();
if (file_size == 0U) { if (file_size == 0U) {
curl_easy_setopt(curl, CURLOPT_INFILESIZE, 0L); curl_easy_setopt(curl, CURLOPT_INFILESIZE, 0L);
return true; return true;