Skip to content

Commit 6f67cf1

Browse files
authored
arg : -hf do not fail if url mismatch (#13219)
* arg : -hf do not fail if url mismatch * do not return if cannot parse metadata json
1 parent 16a457f commit 6f67cf1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

common/arg.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,17 @@ static bool common_download_file_single(const std::string & url, const std::stri
287287
try {
288288
metadata_in >> metadata;
289289
LOG_DBG("%s: previous metadata file found %s: %s\n", __func__, metadata_path.c_str(), metadata.dump().c_str());
290-
if (metadata.contains("url") && metadata.at("url").is_string()) {
291-
auto previous_url = metadata.at("url").get<std::string>();
292-
if (previous_url != url) {
293-
LOG_ERR("%s: Model URL mismatch: %s != %s\n", __func__, url.c_str(), previous_url.c_str());
294-
return false;
295-
}
296-
}
297290
if (metadata.contains("etag") && metadata.at("etag").is_string()) {
298291
etag = metadata.at("etag");
299292
}
300293
if (metadata.contains("lastModified") && metadata.at("lastModified").is_string()) {
301294
last_modified = metadata.at("lastModified");
302295
}
303296
} catch (const nlohmann::json::exception & e) {
304-
LOG_ERR("%s: error reading metadata file %s: %s\n", __func__, metadata_path.c_str(), e.what());
305-
return false;
297+
LOG_ERR("%s: error reading metadata file %s: %s\n", __func__, metadata_path.c_str(), e.what());
306298
}
307299
}
300+
// if we cannot open the metadata file, we assume that the downloaded file is not valid (etag and last-modified are left empty, so we will download it again)
308301
} else {
309302
LOG_INF("%s: no previous model file found %s\n", __func__, path.c_str());
310303
}

0 commit comments

Comments
 (0)