fix(updater): validate endpoint scheme before printing warning (#1868)

regression from #1814
This commit is contained in:
Lucas Fernandes Nogueira
2024-10-02 16:28:16 -03:00
committed by GitHub
parent e8069af804
commit 9501cfa5f5
2 changed files with 11 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"updater": patch
---
Fix configuration parser incorrectly warning about the endpoint scheme.
+6 -7
View File
@@ -142,14 +142,13 @@ pub(crate) fn validate_endpoints(
) -> crate::Result<()> {
if !dangerous_insecure_transport_protocol {
for url in endpoints {
#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
eprintln!("[\x1b[33mWARNING\x1b[0m] The updater endpoint \"{url}\" doesn't use `https` protocol. This is allowed in development but will fail in release builds.");
#[cfg(debug_assertions)]
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");
#[cfg(not(debug_assertions))]
if url.scheme() != "https" {
#[cfg(debug_assertions)]
{
eprintln!("[\x1b[33mWARNING\x1b[0m] The updater endpoint \"{url}\" doesn't use `https` protocol. This is allowed in development but will fail in release builds.");
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");
}
#[cfg(not(debug_assertions))]
return Err(crate::Error::InsecureTransportProtocol);
}
}