mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Improve error message if filename does not match document/tracking/id and let it be reported by the proper reporter (#382)
* Improve error message if filename does not match document/tracking/id and let it be reported by the proper reporter * style: remove unnecessary "\n" * style: convert space to tab to calm linter --------- Co-authored-by: JanHoefelmeyer <hoefelmeyer.jan@gmail.com> Co-authored-by: JanHoefelmeyer <Jan Höfelmeyer jhoefelmeyer@intevation.de> Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com>
This commit is contained in:
parent
b61912410a
commit
f97891c283
2 changed files with 3 additions and 3 deletions
|
|
@ -695,7 +695,7 @@ func (p *processor) integrity(
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := util.IDMatchesFilename(p.expr, doc, filepath.Base(u)); err != nil {
|
if err := util.IDMatchesFilename(p.expr, doc, filepath.Base(u)); err != nil {
|
||||||
p.invalidAdvisories.error("%s: %v\n", u, err)
|
p.badFilenames.error("%s: %v", u, err)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ func IDMatchesFilename(eval *PathEval, doc any, filename string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if CleanFileName(id) != filename {
|
if CleanFileName(id) != filename {
|
||||||
return fmt.Errorf("document/tracking/id %q does not match filename %s",
|
return fmt.Errorf("filename %s does not match document/tracking/id %q",
|
||||||
id, filename)
|
filename, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue