Skip to content

Commit 9501cfa

Browse files
authored
fix(updater): validate endpoint scheme before printing warning (#1868)
regression from #1814
1 parent e8069af commit 9501cfa

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.changes/fix-updater-warning.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"updater": patch
3+
---
4+
5+
Fix configuration parser incorrectly warning about the endpoint scheme.

plugins/updater/src/config.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,13 @@ pub(crate) fn validate_endpoints(
142142
) -> crate::Result<()> {
143143
if !dangerous_insecure_transport_protocol {
144144
for url in endpoints {
145-
#[cfg(debug_assertions)]
146-
#[cfg(debug_assertions)]
147-
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.");
148-
#[cfg(debug_assertions)]
149-
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");
150-
151-
#[cfg(not(debug_assertions))]
152145
if url.scheme() != "https" {
146+
#[cfg(debug_assertions)]
147+
{
148+
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.");
149+
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");
150+
}
151+
#[cfg(not(debug_assertions))]
153152
return Err(crate::Error::InsecureTransportProtocol);
154153
}
155154
}

0 commit comments

Comments
 (0)