Fix wslc push/pull progress display glitches (#40676)

- Render byte counts with FormatBytes instead of a bogus 's' suffix. - Drop the '/total' when current exceeds Docker's estimated total so the progress never displays over 100%.

Kevin Vega committed May 30, 2026 at 16:41 UTC 8ea4ea8d0bca0f3d61a2eb22b460e0f82bdc9026
1 file changed +11 -3
src/windows/wslc/services/ImageProgressCallback.cpp
+11 -3
@@ -105,12 +105,20 @@ std::wstring ImageProgressCallback::GenerateStatusLine(LPCSTR status, LPCSTR id,
105 bar.append(L">");
106 bar.resize(c_progressBarWidth, L' ');
107
108 - line = std::format(
109 - L"{}: {} [{}] {}/{}", id, status, bar, wsl::shared::string::FormatBytes(current), wsl::shared::string::FormatBytes(total));
108 + // Docker's reported total is an estimate of the compressed layer size, so the actual bytes
109 + // transferred can exceed it. Drop the total in that case to avoid displaying a count over 100%.
110 + auto progress = wsl::shared::string::FormatBytes(current);
111 +
112 + if (current <= total)
113 + {
114 + progress += std::format(L"/{}", wsl::shared::string::FormatBytes(total));
115 + }
116 +
117 + line = std::format(L"{}: {} [{}] {}", id, status, bar, progress);
118 }
119 else if (current != 0)
120 {
113 - line = std::format(L"{}: {} {}s", id, status, current);
121 + line = std::format(L"{}: {} {}", id, status, wsl::shared::string::FormatBytes(current));
122 }
123 else
124 {