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 {