mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-16 20:01:35 +01:00
fix copy artifact issue (#18460)
To enable the middleware to save the project_blob data, make sure to set the accessories options to true when handling the artifact copy. Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
cb0749c7ab
commit
fddfaa7ba5
@ -60,7 +60,7 @@ func CopyArtifactMiddleware() func(http.Handler) http.Handler {
|
|||||||
from := query.Get("from")
|
from := query.Get("from")
|
||||||
repository, reference, _ := distribution.ParseRef(from)
|
repository, reference, _ := distribution.ParseRef(from)
|
||||||
|
|
||||||
art, err := artifactController.GetByReference(ctx, repository, reference, nil)
|
art, err := artifactController.GetByReference(ctx, repository, reference, &artifact.Option{WithAccessory: true})
|
||||||
if errors.IsNotFoundErr(err) {
|
if errors.IsNotFoundErr(err) {
|
||||||
// artifact not found, discontinue the API request
|
// artifact not found, discontinue the API request
|
||||||
return errors.BadRequestError(nil).WithMessage("artifact %s not found", from)
|
return errors.BadRequestError(nil).WithMessage("artifact %s not found", from)
|
||||||
@ -85,7 +85,7 @@ func CopyArtifactMiddleware() func(http.Handler) http.Handler {
|
|||||||
err = artifactController.Walk(ctx, art, func(a *artifact.Artifact) error {
|
err = artifactController.Walk(ctx, art, func(a *artifact.Artifact) error {
|
||||||
artifactDigests = append(artifactDigests, a.Digest)
|
artifactDigests = append(artifactDigests, a.Digest)
|
||||||
return nil
|
return nil
|
||||||
}, nil)
|
}, &artifact.Option{WithAccessory: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("walk the artifact %s failed, error: %v", art.Digest, err)
|
logger.Errorf("walk the artifact %s failed, error: %v", art.Digest, err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user