From 28ec084e56ddb88da9e7fc217d968988a6f4379a Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Mon, 16 Oct 2023 19:39:02 +0200 Subject: [PATCH] fix(updater): Fix endpoint string replacements, fixes #655 (#662) * fix(updater): Fix endpoint string replacements, fixes #655 * fmt --- .changes/updater-string-replace.md | 5 +++++ plugins/updater/src/updater.rs | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changes/updater-string-replace.md diff --git a/.changes/updater-string-replace.md b/.changes/updater-string-replace.md new file mode 100644 index 000000000..1e682ef30 --- /dev/null +++ b/.changes/updater-string-replace.md @@ -0,0 +1,5 @@ +--- +"updater": "patch" +--- + +The plugin now correctly replaces `arch`, `current_version` and `target` again. diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index 385e1e870..99db57acb 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -258,9 +258,13 @@ impl Updater { // the URL will be generated dynamically let url: Url = url .to_string() - .replace("{{current_version}}", &self.current_version.to_string()) - .replace("{{target}}", &self.target) - .replace("{{arch}}", self.arch) + // url::Url automatically url-encodes the string + .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) .parse()?; let mut request = Client::new().get(url).headers(headers.clone());