From f86f1cebc3a1af8c5c14c0a94d687fff04ebc6eb Mon Sep 17 00:00:00 2001 From: "stonezdj(Daojun Zhang)" Date: Thu, 4 Jul 2024 15:42:12 +0800 Subject: [PATCH] Change the log message when PostScan failed. (#20650) fixes #20573 remove s from additions/sboms in the link Signed-off-by: stonezdj --- src/controller/artifact/model.go | 3 ++- src/pkg/scan/job.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controller/artifact/model.go b/src/controller/artifact/model.go index 0953fd0690f..6bf731dd754 100644 --- a/src/controller/artifact/model.go +++ b/src/controller/artifact/model.go @@ -80,6 +80,7 @@ func (artifact *Artifact) SetAdditionLink(addition, version string) { artifact.AdditionLinks[addition] = &AdditionLink{HREF: href, Absolute: false} } +// SetSBOMAdditionLink set the link of SBOM addition func (artifact *Artifact) SetSBOMAdditionLink(sbomDgst string, version string) { if artifact.AdditionLinks == nil { artifact.AdditionLinks = make(map[string]*AdditionLink) @@ -88,7 +89,7 @@ func (artifact *Artifact) SetSBOMAdditionLink(sbomDgst string, version string) { projectName, repo := utils.ParseRepository(artifact.RepositoryName) // encode slash as %252F repo = repository.Encode(repo) - href := fmt.Sprintf("/api/%s/projects/%s/repositories/%s/artifacts/%s/additions/%s", version, projectName, repo, sbomDgst, addition) + href := fmt.Sprintf("/api/%s/projects/%s/repositories/%s/artifacts/%s/additions/sbom", version, projectName, repo, sbomDgst) artifact.AdditionLinks[addition] = &AdditionLink{HREF: href, Absolute: false} } diff --git a/src/pkg/scan/job.go b/src/pkg/scan/job.go index f0db850e627..e485a143dd1 100644 --- a/src/pkg/scan/job.go +++ b/src/pkg/scan/job.go @@ -304,7 +304,7 @@ func (j *Job) Run(ctx job.Context, params job.Parameters) error { reportData, err := handler.PostScan(ctx, req, rp, rawReports[i], startTime, robotAccount) if err != nil { - myLogger.Errorf("Failed to convert vulnerability data to new schema for report %s, error %v", rp.UUID, err) + myLogger.Errorf("handler failed at PostScan, report %s, error %v", rp.UUID, err) return err }