From 9501cfa5f5385b2d7eb43a8378b322ee97cba06f Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 2 Oct 2024 16:28:16 -0300 Subject: [PATCH] fix(updater): validate endpoint scheme before printing warning (#1868) regression from #1814 --- .changes/fix-updater-warning.md | 5 +++++ plugins/updater/src/config.rs | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .changes/fix-updater-warning.md diff --git a/.changes/fix-updater-warning.md b/.changes/fix-updater-warning.md new file mode 100644 index 000000000..394e38ac3 --- /dev/null +++ b/.changes/fix-updater-warning.md @@ -0,0 +1,5 @@ +--- +"updater": patch +--- + +Fix configuration parser incorrectly warning about the endpoint scheme. diff --git a/plugins/updater/src/config.rs b/plugins/updater/src/config.rs index b95c6ae4f..6b16bc01f 100644 --- a/plugins/updater/src/config.rs +++ b/plugins/updater/src/config.rs @@ -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); } }