common : cont

ggml-ci
This commit is contained in:
Georgi Gerganov 2025-01-12 16:53:44 +02:00
parent a59ee7c4eb
commit 36803b1902
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -1294,18 +1294,18 @@ static bool common_download_file(const std::string & url, const std::string & pa
curl_easy_setopt(curl.get(), CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl.get(), CURLOPT_NOPROGRESS, 0L);
// helper function to hide password in URL // helper function to hide password in URL
auto llama_download_hide_password_in_url = [](const std::string & url) -> std::string { auto llama_download_hide_password_in_url = [](const std::string & url_full) -> std::string {
std::size_t protocol_pos = url.find("://"); std::size_t protocol_pos = url_full.find("://");
if (protocol_pos == std::string::npos) { if (protocol_pos == std::string::npos) {
return url; // Malformed URL return url_full; // Malformed URL
} }
std::size_t at_pos = url.find('@', protocol_pos + 3); std::size_t at_pos = url_full.find('@', protocol_pos + 3);
if (at_pos == std::string::npos) { if (at_pos == std::string::npos) {
return url; // No password in URL return url_full; // No password in URL
} }
return url.substr(0, protocol_pos + 3) + "********" + url.substr(at_pos); return url_full.substr(0, protocol_pos + 3) + "********" + url_full.substr(at_pos);
}; };
// start the download // start the download