mirror of
https://github.com/Quiq/docker-registry-ui.git
synced 2025-07-16 15:25:59 +00:00
Don't match regexp if empty
This commit is contained in:
parent
f769e3e5f9
commit
a939599a1c
@ -86,9 +86,13 @@ func PurgeOldTags(client *Client, purgeDryRun bool, purgeTagsKeepDays, purgeTags
|
||||
|
||||
// Filter out tags by retention days and regexp
|
||||
for _, tag := range repos[repo] {
|
||||
regexpMatch, _ := regexp.MatchString(purgeTagsKeepRegexp, tag.name)
|
||||
regexpKeep := false
|
||||
if purgeTagsKeepRegexp != "" {
|
||||
regexpMatch, _ := regexp.MatchString(purgeTagsKeepRegexp, tag.name)
|
||||
regexpKeep = regexpMatch
|
||||
}
|
||||
delta := int(now.Sub(tag.created).Hours() / 24)
|
||||
if !regexpMatch && delta > purgeTagsKeepDays {
|
||||
if !regexpKeep && delta > purgeTagsKeepDays {
|
||||
purgeTags[repo] = append(purgeTags[repo], tag.name)
|
||||
} else {
|
||||
keepTags[repo] = append(keepTags[repo], tag.name)
|
||||
|
Loading…
Reference in New Issue
Block a user