Skip to content

Commit

Permalink
fix(cleanup): fail on getting manifests for some custom tag metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Aug 31, 2022
1 parent 1026317 commit fa2c72f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
15 changes: 0 additions & 15 deletions pkg/slug/slug.go
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions pkg/slug/slug_test.go
Expand Up @@ -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 {
Expand Down

0 comments on commit fa2c72f

Please sign in to comment.