From 3d15793b693ccbdb2f1f5378e5e8ad7fec3604cf Mon Sep 17 00:00:00 2001 From: Colin Holzman Date: Sun, 21 Dec 2025 17:45:34 -0500 Subject: [PATCH] fix: FormatSizeBytes reports incorrect sizes with fractional-gigabytes. (#1006) --- internal/orchestrator/tasks/hookvars.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/orchestrator/tasks/hookvars.go b/internal/orchestrator/tasks/hookvars.go index 2366ae5b..781809cc 100644 --- a/internal/orchestrator/tasks/hookvars.go +++ b/internal/orchestrator/tasks/hookvars.go @@ -88,16 +88,14 @@ func (v HookVars) number(n any) int { } func (v HookVars) FormatSizeBytes(val any) string { - size := v.number(val) + size := float64(v.number(val)) sizes := []string{"B", "KB", "MB", "GB", "TB", "PB"} i := 0 - prev := size for size > 1000 { size /= 1000 - prev = size i++ } - return fmt.Sprintf("%d.%03d %s", size, prev, sizes[i]) + return fmt.Sprintf("%.3f %s", size, sizes[i]) } func (v HookVars) IsError(cond v1.Hook_Condition) bool {