Skip to content

Commit

Permalink
Fix: conformance test "References setup" of "Content Discovery"
Browse files Browse the repository at this point in the history
Signed-off-by: Shengwen Yu <[email protected]>
  • Loading branch information
Shengwen Yu authored and MinerYang committed Aug 28, 2023
1 parent 29794f0 commit 69bc15f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/controller/artifact/processor/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ func (d *defaultProcessor) AbstractMetadata(ctx context.Context, artifact *artif
metadata := map[string]interface{}{}
// Some artifact may not have empty config layer.
if mani.Config.Size != 0 {
if err := json.NewDecoder(blob).Decode(&metadata); err != nil {
return err
if mani.Config.MediaType == v1.MediaTypeImageConfig || mani.Config.MediaType == schema2.MediaTypeImageConfig {
if err := json.NewDecoder(blob).Decode(&metadata); err != nil {
log.Errorf("failed to decode metadata, err=%v", err)
return err
}
} else {
log.Infof("do not decode mani.Config.Digest=[%s], because mani.Config.MediaType is not %s, or %s",
mani.Config.Digest.String(), v1.MediaTypeImageConfig, schema2.MediaTypeImageConfig)
}
}
// Populate all metadata into the ExtraAttrs first.
Expand Down
4 changes: 3 additions & 1 deletion src/server/middleware/subject/subject.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ func Middleware() func(http.Handler) http.Handler {
return err
}
}
w.Header().Set("OCI-Subject", subjectArt.Digest)
// subjectArt could be nil
// w.Header().Set("OCI-Subject", subjectArt.Digest)
w.Header().Set("OCI-Subject", mf.Subject.Digest.String())
}

return nil
Expand Down

0 comments on commit 69bc15f

Please sign in to comment.