Skip to content

Commit 4362e8d

Browse files
committed
diff/report: fix key regexp
The current regexp doesn't match all possible apis, for example `cert-manager.io`. As there is a closing `)` we can simply take everything before it. Also resource names can have . in their name.
1 parent e41445a commit 4362e8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff/report.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func setupTemplateReport(r *Report) {
191191
// report with template output will only have access to ReportTemplateSpec.
192192
// This function reverts parsedMetadata.String()
193193
func (t *ReportTemplateSpec) loadFromKey(key string) error {
194-
pattern := regexp.MustCompile(`(?P<namespace>[a-z0-9-]+), (?P<name>[a-z0-9-]+), (?P<kind>\w+) \((?P<api>[a-z0-9.]+)\)`)
194+
pattern := regexp.MustCompile(`(?P<namespace>[a-z0-9-]+), (?P<name>[a-z0-9.-]+), (?P<kind>\w+) \((?P<api>[^)]+)\)`)
195195
matches := pattern.FindStringSubmatch(key)
196196
if len(matches) > 1 {
197197
t.Namespace = matches[1]

0 commit comments

Comments
 (0)