From a75ed8166826a69c2f2ff2b5e50e483c6d956ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 9 Mar 2024 22:51:50 +0100 Subject: [PATCH] Use strings.CutSuffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miloslav Trmač --- integration/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/utils.go b/integration/utils.go index f0e4484323..7f75c95b8d 100644 --- a/integration/utils.go +++ b/integration/utils.go @@ -268,8 +268,8 @@ func decompressDir(t *testing.T, dir string) { rawLayer["size"] = uncompressedSize var mimeType string getRawMapField(t, rawLayer, "mediaType", &mimeType) - if strings.HasSuffix(mimeType, ".gzip") { // This should use CutSuffix with Go ≥1.20 - rawLayer["mediaType"] = strings.TrimSuffix(mimeType, ".gzip") + if uncompressedMIMEType, ok := strings.CutSuffix(mimeType, ".gzip"); ok { + rawLayer["mediaType"] = uncompressedMIMEType } rawLayers[i] = rawLayer