1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +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:
JanHoefelmeyer 2023-06-30 23:36:54 +02:00 committed by GitHub
parent b61912410a
commit f97891c283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -695,7 +695,7 @@ func (p *processor) integrity(
}
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
}

View file

@ -49,8 +49,8 @@ func IDMatchesFilename(eval *PathEval, doc any, filename string) error {
}
if CleanFileName(id) != filename {
return fmt.Errorf("document/tracking/id %q does not match filename %s",
id, filename)
return fmt.Errorf("filename %s does not match document/tracking/id %q",
filename, id)
}
return nil