Skip to content

Commit

Permalink
Change the log message when PostScan failed.
Browse files Browse the repository at this point in the history
  fixes goharbor#20573
  remove s from additions/sboms in the link

Signed-off-by: stonezdj <[email protected]>
  • Loading branch information
stonezdj committed Jul 2, 2024
1 parent 7ffc378 commit e4a14f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controller/artifact/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/scan/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e4a14f8

Please sign in to comment.