From 0864c541474222c04eea309c404695503327f452 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 22 Nov 2023 16:08:24 +0100 Subject: [PATCH] fix(updater): replace url vars in query params (#756) --- .changes/updater-string-replace-round2.md | 5 +++++ plugins/updater/src/updater.rs | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changes/updater-string-replace-round2.md diff --git a/.changes/updater-string-replace-round2.md b/.changes/updater-string-replace-round2.md new file mode 100644 index 00000000..0e4c138b --- /dev/null +++ b/.changes/updater-string-replace-round2.md @@ -0,0 +1,5 @@ +--- +"updater": "patch" +--- + +The plugin now correctly replaces `arch`, `current_version` and `target` in query params again. diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index 303bbdbe..3b93beef 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -258,13 +258,17 @@ impl Updater { // the URL will be generated dynamically let url: Url = url .to_string() - // url::Url automatically url-encodes the string + // url::Url automatically url-encodes the path components .replace( "%7B%7Bcurrent_version%7D%7D", &self.current_version.to_string(), ) .replace("%7B%7Btarget%7D%7D", &self.target) .replace("%7B%7Barch%7D%7D", self.arch) + // but not query parameters + .replace("{{current_version}}", &self.current_version.to_string()) + .replace("{{target}}", &self.target) + .replace("{{arch}}", self.arch) .parse()?; let mut request = Client::new().get(url).headers(headers.clone());