From f97891c283b6151cf1779cdcb542025fde7864cf Mon Sep 17 00:00:00 2001 From: JanHoefelmeyer <107021473+JanHoefelmeyer@users.noreply.github.com> Date: Fri, 30 Jun 2023 23:36:54 +0200 Subject: [PATCH] Improve error message if filename does not match document/tracking/id and let it be reported by the proper reporter (#382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: JanHoefelmeyer Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- cmd/csaf_checker/processor.go | 2 +- util/file.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/csaf_checker/processor.go b/cmd/csaf_checker/processor.go index 485f6ae..5d5d1a5 100644 --- a/cmd/csaf_checker/processor.go +++ b/cmd/csaf_checker/processor.go @@ -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 } diff --git a/util/file.go b/util/file.go index 266d720..bff7110 100644 --- a/util/file.go +++ b/util/file.go @@ -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