Skip to content

Commit be697d3

Browse files
maxbeizerCopilot
andauthored
fix: normalize v prefix when comparing versions (#216)
The version from goreleaser ('0.9.0') and the GitHub release tag ('v0.9.0') didn't match as strings, causing the upgrade nudge to show even when already on the latest version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 785443e commit be697d3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

internal/tui/components/header/header.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ func (m Model) renderVersionBadge() string {
205205
versionStyle := lipgloss.NewStyle().Faint(true)
206206
badge := versionStyle.Render("v" + strings.TrimPrefix(m.version, "v"))
207207

208-
if m.upgradeVersion != "" && m.upgradeVersion != m.version {
208+
current := strings.TrimPrefix(m.version, "v")
209+
latest := strings.TrimPrefix(m.upgradeVersion, "v")
210+
if latest != "" && latest != current {
209211
upgradeStyle := lipgloss.NewStyle().
210212
Foreground(lipgloss.AdaptiveColor{Light: "214", Dark: "214"})
211-
badge += " " + upgradeStyle.Render("⬆ "+m.upgradeVersion+" available")
213+
badge += " " + upgradeStyle.Render("⬆ v"+latest+" available")
212214
}
213215
return badge
214216
}

0 commit comments

Comments
 (0)