File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,6 +283,13 @@ static int common_download_file_single_online(const std::string & url,
283283 static const int max_attempts = 3 ;
284284 static const int retry_delay_seconds = 2 ;
285285
286+ const bool file_exists = std::filesystem::exists (path);
287+
288+ if (file_exists && skip_etag) {
289+ LOG_DBG (" %s: using cached file: %s\n " , __func__, path.c_str ());
290+ return 304 ; // 304 Not Modified - fake cached response
291+ }
292+
286293 auto [cli, parts] = common_http_client (url);
287294
288295 httplib::Headers headers;
@@ -297,13 +304,6 @@ static int common_download_file_single_online(const std::string & url,
297304 }
298305 cli.set_default_headers (headers);
299306
300- const bool file_exists = std::filesystem::exists (path);
301-
302- if (file_exists && skip_etag) {
303- LOG_DBG (" %s: using cached file: %s\n " , __func__, path.c_str ());
304- return 304 ; // 304 Not Modified - fake cached response
305- }
306-
307307 std::string last_etag;
308308 if (file_exists) {
309309 last_etag = read_etag (path);
You can’t perform that action at this time.
0 commit comments