From fa2c72f48bcdfcf32837f667641f85039753b458 Mon Sep 17 00:00:00 2001 From: Alexey Igrychev Date: Wed, 31 Aug 2022 15:54:48 +0100 Subject: [PATCH] fix(cleanup): fail on getting manifests for some custom tag metadata Signed-off-by: Alexey Igrychev --- pkg/slug/slug.go | 15 --------------- pkg/slug/slug_test.go | 6 ++++++ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/pkg/slug/slug.go b/pkg/slug/slug.go index d1e6187fda..a9a9918871 100644 --- a/pkg/slug/slug.go +++ b/pkg/slug/slug.go @@ -56,26 +56,11 @@ func shouldBeSlugged(data string, slugMaxSize int) bool { return true } - // data length cannot be equal or less than service part - servicePartSize := len(util.MurmurHash("ANY")) + len(slugSeparator) - if len(data) <= servicePartSize { - return true - } - // data must contain only one sequence if strings.Count(data, "--") != 1 { return true } - // data must contain sequence in a certain place - { - firstHyphenInd := len(data) - servicePartSize - 1 - ind := strings.Index(data, "--") - if firstHyphenInd != ind { - return true - } - } - // data without sequence must be valid { formattedData := strings.Replace(data, "--", "-", 1) diff --git a/pkg/slug/slug_test.go b/pkg/slug/slug_test.go index eef0da25b8..a8b2cff3cc 100644 --- a/pkg/slug/slug_test.go +++ b/pkg/slug/slug_test.go @@ -44,6 +44,12 @@ func TestSlug(t *testing.T) { maxSize: &legacyCaseWithTwoHyphensMaxSize, result: "postgres-feature-31981-change-delivery--852739dc", }, + { + name: "legacyCaseWithTwoHyphen_2", + data: "php_fpm_exporter-monitoring-dev-encrypt-1", + maxSize: &legacyCaseWithTwoHyphensMaxSize, + result: "php-fpm-exporter-monitoring-dev-encrypt--83286e5", + }, } for _, test := range tests {