From 6b4781941b811409d349db55499a6dc4fdc3daf7 Mon Sep 17 00:00:00 2001 From: Evan Jarrett Date: Sun, 17 May 2026 15:34:30 -0500 Subject: [PATCH] fix display size on repo page --- pkg/appview/handlers/repository.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/appview/handlers/repository.go b/pkg/appview/handlers/repository.go index 6219dd2..69c4941 100644 --- a/pkg/appview/handlers/repository.go +++ b/pkg/appview/handlers/repository.go @@ -24,7 +24,7 @@ import ( type SelectedTagData struct { Info *db.TagWithPlatforms LayerCount int - CompressedSize int64 // total across all platforms + CompressedSize int64 // largest platform's size for multi-arch; size for single-arch ScanBatchParams []template.HTML } @@ -122,14 +122,18 @@ func (h *RepositoryPageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request } tagData.Platforms = platforms - // Compute total compressed size across all platforms - var totalSize int64 + // For multi-arch, show the largest platform's size — a client only + // pulls one platform, so summing across all would overstate the + // download size. + var displaySize int64 if tagData.IsMultiArch { for _, p := range platforms { - totalSize += p.CompressedSize + if p.CompressedSize > displaySize { + displaySize = p.CompressedSize + } } } else { - totalSize = tagData.CompressedSize + displaySize = tagData.CompressedSize } // Get layer count from image config (includes empty layers) @@ -162,7 +166,7 @@ func (h *RepositoryPageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request selectedTag = &SelectedTagData{ Info: tagData, LayerCount: layerCount, - CompressedSize: totalSize, + CompressedSize: displaySize, ScanBatchParams: scanBatchParams, } }