mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Extract more than one string from expr: category fields.
This commit is contained in:
parent
1d0499ddea
commit
8c8ccf6a2e
4 changed files with 64 additions and 6 deletions
|
|
@ -451,18 +451,19 @@ func (w *worker) extractCategories(label string, advisory any) error {
|
|||
w.categories[label] = cats
|
||||
}
|
||||
|
||||
var result string
|
||||
matcher := util.StringMatcher(&result)
|
||||
|
||||
const exprPrefix = "expr:"
|
||||
|
||||
for _, cat := range categories {
|
||||
if strings.HasPrefix(cat, exprPrefix) {
|
||||
expr := cat[len(exprPrefix):]
|
||||
var results []string
|
||||
matcher := util.StringTreeMatcher(&results)
|
||||
if err := w.expr.Extract(expr, matcher, true, advisory); err != nil {
|
||||
return err
|
||||
}
|
||||
cats[result] = true
|
||||
for _, result := range results {
|
||||
cats[result] = true
|
||||
}
|
||||
} else { // Normal
|
||||
cats[cat] = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue