Prefer using cache file when opening files if it exists
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-02-21 15:25:25 -06:00
parent b47088bb53
commit 5357e1715c
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@
* Fixed setting `HostConfig.Path` via `set_value_by_name`
* Fixed setting `HostConfig.Protocol` via `set_value_by_name`
* Integrated `renterd` version 2.x
* Prefer using cache file when opening files if it exists
* Refactored `app_config` unit tests
* Refactored polling to be more accurate on scheduling tasks

View File

@ -466,6 +466,13 @@ auto file_manager::open(const std::string &api_path, bool directory,
return download_type::default_;
}
if (utils::file::file{fsi.source_path}.exists()) {
auto size = utils::file::file{fsi.source_path}.size();
if (size.has_value() && *size == fsi.size) {
return download_type::default_;
}
}
if (type == download_type::direct) {
return type;
}