fix stats url handling

This commit is contained in:
David Laban 2024-09-11 09:07:53 +01:00
parent dd45ab6ad7
commit d83bcf3133
3 changed files with 5 additions and 7 deletions

View file

@ -675,7 +675,7 @@ mod test {
.unwrap()
.to_string();
assert!(
long_help.ends_with(binstalk::QUICK_INSTALL_STATS_URL),
long_help.ends_with(binstalk::QUICKINSTALL_STATS_URL),
"{}",
long_help
);

View file

@ -16,7 +16,7 @@ use crate::{
};
const BASE_URL: &str = "https://github.com/cargo-bins/cargo-quickinstall/releases/download";
pub const QUICK_INSTALL_STATS_URL: &str =
pub const QUICKINSTALL_STATS_URL: &str =
"https://cargo-quickinstall-stats-server.fly.dev/record-install";
const QUICKINSTALL_SIGN_KEY: Cow<'static, str> =
@ -63,7 +63,6 @@ pub struct QuickInstall {
package: String,
package_url: Url,
signature_url: Url,
stats_url: Url,
signature_policy: SignaturePolicy,
target_data: Arc<TargetDataErased>,
@ -179,8 +178,6 @@ impl super::Fetcher for QuickInstall {
.expect("package_url is pre-generated and should never be invalid url"),
signature_url: Url::parse(&format!("{url}.sig"))
.expect("signature_url is pre-generated and should never be invalid url"),
stats_url: Url::parse("{QUICK_INSTALL_STATS_URL}")
.expect("stats_url is pre-generated and should never be invalid url"),
package,
signature_policy,
@ -321,7 +318,8 @@ impl QuickInstall {
return Ok(());
}
let mut url = self.stats_url.clone();
let mut url = Url::parse(QUICKINSTALL_STATS_URL)
.expect("stats_url is pre-generated and should never be invalid url");
url.query_pairs_mut()
.append_pair("crate", &self.data.name)
.append_pair("version", &self.data.version)

View file

@ -10,4 +10,4 @@ pub use binstalk_registry as registry;
pub use binstalk_types as manifests;
pub use detect_targets::{get_desired_targets, DesiredTargets, TARGET};
pub use fetchers::QUICK_INSTALL_STATS_URL;
pub use fetchers::QUICKINSTALL_STATS_URL;