on main help sign in
fix(ui): strip .0 from file sizes, replace last context.TODO()
55b6944iko
internal/config/store.go+1−1
@@ -777,7 +777,7 @@ func (s *ConfigStore) ImportCopilot() (*oauth.Token, bool) {
777 }
777 }
778
778
779 slog.Info("Found existing GitHub Copilot token on disk. Authenticating...")
779 slog.Info("Found existing GitHub Copilot token on disk. Authenticating...")
780− token, err := copilot.RefreshToken(context.TODO(), diskToken)
780+ token, err := copilot.RefreshToken(context.Background(), diskToken)
781 if err != nil {
781 if err != nil {
782 slog.Error("Unable to import GitHub Copilot token", "error", err)
782 slog.Error("Unable to import GitHub Copilot token", "error", err)
783 return nil, false
783 return nil, false
internal/ui/chat/tools.go+10−2
@@ -968,9 +968,17 @@ func formatSize(bytes int) string {
968 )
968 )
969 switch {
969 switch {
970 case bytes >= mb:
970 case bytes >= mb:
971− return fmt.Sprintf("%.1f MB", float64(bytes)/float64(mb))
971+ result := fmt.Sprintf("%.1f MB", float64(bytes)/float64(mb))
972+ if strings.HasSuffix(result, ".0 MB") {
973+ result = strings.Replace(result, ".0 MB", " MB", 1)
974+ }
975+ return result
972 case bytes >= kb:
976 case bytes >= kb:
973− return fmt.Sprintf("%.1f KB", float64(bytes)/float64(kb))
977+ result := fmt.Sprintf("%.1f KB", float64(bytes)/float64(kb))
978+ if strings.HasSuffix(result, ".0 KB") {
979+ result = strings.Replace(result, ".0 KB", " KB", 1)
980+ }
981+ return result
974 default:
982 default:
975 return fmt.Sprintf("%d B", bytes)
983 return fmt.Sprintf("%d B", bytes)
976 }
984 }