From 20100ad720ce243b4c7ee82a4fc9fe512745338f Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Wed, 30 Apr 2025 19:17:59 +0200 Subject: [PATCH 1/2] arg : -hf do not fail if url mismatch --- common/arg.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/common/arg.cpp b/common/arg.cpp index b8c72ee6457dc..7ee8304dc5a17 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -287,13 +287,6 @@ static bool common_download_file_single(const std::string & url, const std::stri try { metadata_in >> metadata; LOG_DBG("%s: previous metadata file found %s: %s\n", __func__, metadata_path.c_str(), metadata.dump().c_str()); - if (metadata.contains("url") && metadata.at("url").is_string()) { - auto previous_url = metadata.at("url").get(); - if (previous_url != url) { - LOG_ERR("%s: Model URL mismatch: %s != %s\n", __func__, url.c_str(), previous_url.c_str()); - return false; - } - } if (metadata.contains("etag") && metadata.at("etag").is_string()) { etag = metadata.at("etag"); } @@ -301,10 +294,11 @@ static bool common_download_file_single(const std::string & url, const std::stri last_modified = metadata.at("lastModified"); } } catch (const nlohmann::json::exception & e) { - LOG_ERR("%s: error reading metadata file %s: %s\n", __func__, metadata_path.c_str(), e.what()); + LOG_ERR("%s: error reading metadata file %s: %s\n", __func__, metadata_path.c_str(), e.what()); return false; } } + // 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) } else { LOG_INF("%s: no previous model file found %s\n", __func__, path.c_str()); } From 18c793df0e8d6f642547f19b0409e075a4d76fc6 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Wed, 30 Apr 2025 19:25:45 +0200 Subject: [PATCH 2/2] do not return if cannot parse metadata json --- common/arg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/arg.cpp b/common/arg.cpp index 7ee8304dc5a17..9f7241673d507 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -295,7 +295,6 @@ static bool common_download_file_single(const std::string & url, const std::stri } } catch (const nlohmann::json::exception & e) { LOG_ERR("%s: error reading metadata file %s: %s\n", __func__, metadata_path.c_str(), e.what()); - return false; } } // 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)