Skip to content

Commit

Permalink
get_file_size(): check -1
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Sep 19, 2024
1 parent 4032fee commit c87ad73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/include/kvikio/remote_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ inline std::size_t get_file_size(std::string url)

curl_off_t cl;
curl.getinfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
if (cl < 0) {
throw std::runtime_error("cannot get size of " + url +
", content-length not provided by the server");
}
return cl;
}

Expand Down

0 comments on commit c87ad73

Please sign in to comment.