Skip to content

Commit

Permalink
fix(updater): replace url vars in query params (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Nov 22, 2023
1 parent 445c1e6 commit 0864c54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/updater-string-replace-round2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"updater": "patch"
---

The plugin now correctly replaces `arch`, `current_version` and `target` in query params again.
6 changes: 5 additions & 1 deletion plugins/updater/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 0864c54

Please sign in to comment.