Skip to content
Permalink
Browse files
fix(cleanup): fail on getting manifests for some custom tag metadata
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Aug 31, 2022
1 parent 1026317 commit fa2c72f48bcdfcf32837f667641f85039753b458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
@@ -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)
@@ -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 {

0 comments on commit fa2c72f

Please sign in to comment.