Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
auto_update: Strip pre-release and build metadata from release notes URL (#48570)
Ruben Fricked3f051031fcc
diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rsindex 9b9ccee3b69..964b07d8751 100644--- a/crates/auto_update/src/auto_update.rs+++ b/crates/auto_update/src/auto_update.rs@@ -252,7 +252,9 @@ pub fn release_notes_url(cx: &mut App) -> Option<String> {ReleaseChannel::Stable | ReleaseChannel::Preview => {let auto_updater = AutoUpdater::get(cx)?;let auto_updater = auto_updater.read(cx);- let current_version = &auto_updater.current_version;+ let mut current_version = auto_updater.current_version.clone();+ current_version.pre = semver::Prerelease::EMPTY;+ current_version.build = semver::BuildMetadata::EMPTY;let release_channel = release_channel.dev_name();let path = format!("/releases/{release_channel}/{current_version}");auto_updater.client.http_client().build_url(&path)@@ -750,8 +752,8 @@ impl AutoUpdater {fetched_version: Version,) -> Result<Option<VersionCheckType>> {// For non-nightly releases, ignore build and pre-release fields as they're not provided by our endpoints right now.- installed_version.build = semver::BuildMetadata::EMPTY;installed_version.pre = semver::Prerelease::EMPTY;+ installed_version.build = semver::BuildMetadata::EMPTY;let should_download = fetched_version > installed_version;let newer_version = should_download.then(|| VersionCheckType::Semantic(fetched_version));Ok(newer_version)diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rsindex 853ce4e7a33..e613d3af688 100644--- a/crates/auto_update_ui/src/auto_update_ui.rs+++ b/crates/auto_update_ui/src/auto_update_ui.rs@@ -270,8 +270,8 @@ pub fn notify_if_app_was_updated(cx: &mut App) {if should_show_notification {cx.update(|cx| {let mut version = updater.read(cx).current_version();- version.build = semver::BuildMetadata::EMPTY;version.pre = semver::Prerelease::EMPTY;+ version.build = semver::BuildMetadata::EMPTY;let app_name = ReleaseChannel::global(cx).display_name();if let Some(content) = announcement_for_version(&version) {