From fddfaa7ba56c880c16c9e60aebf3ea09549d157d Mon Sep 17 00:00:00 2001 From: Wang Yan Date: Mon, 3 Apr 2023 10:58:17 +0800 Subject: [PATCH] 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 --- src/server/middleware/blob/copy_artifact.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/middleware/blob/copy_artifact.go b/src/server/middleware/blob/copy_artifact.go index 0916952b5..15e503944 100644 --- a/src/server/middleware/blob/copy_artifact.go +++ b/src/server/middleware/blob/copy_artifact.go @@ -60,7 +60,7 @@ func CopyArtifactMiddleware() func(http.Handler) http.Handler { from := query.Get("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) { // artifact not found, discontinue the API request 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 { artifactDigests = append(artifactDigests, a.Digest) return nil - }, nil) + }, &artifact.Option{WithAccessory: true}) if err != nil { logger.Errorf("walk the artifact %s failed, error: %v", art.Digest, err) return err