From 232260c1bfe8eee4c8f469ee92b91439a3bc4cb8 Mon Sep 17 00:00:00 2001 From: user123456 Date: Fri, 13 Jun 2025 10:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/imagetar.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/imagetar.go b/src/imagetar.go index 0fcfe05..23d89f1 100644 --- a/src/imagetar.go +++ b/src/imagetar.go @@ -478,11 +478,20 @@ func (is *ImageStreamer) selectPlatformImage(desc *remote.Descriptor, options *S if options.Platform != "" { platformParts := strings.Split(options.Platform, "/") - if len(platformParts) == 2 && - m.Platform.OS == platformParts[0] && - m.Platform.Architecture == platformParts[1] { - selectedDesc = &m - break + if len(platformParts) >= 2 { + targetOS := platformParts[0] + targetArch := platformParts[1] + targetVariant := "" + if len(platformParts) >= 3 { + targetVariant = platformParts[2] + } + + if m.Platform.OS == targetOS && + m.Platform.Architecture == targetArch && + m.Platform.Variant == targetVariant { + selectedDesc = &m + break + } } } else if m.Platform.OS == "linux" && m.Platform.Architecture == "amd64" { selectedDesc = &m