Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to copy manifest with 0 size config #129

Closed
northtyphoon opened this issue Apr 18, 2022 · 2 comments
Closed

Failed to copy manifest with 0 size config #129

northtyphoon opened this issue Apr 18, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@northtyphoon
Copy link

I tried to copy a manifest from registry binducentralus.azurecr.io/samples/artifact:1.0. This manifest has a config whose size is 0.

{
  "schemaVersion": 2,
  "config": {
    "mediaType": "application/vnd.unknown.config.v1+json",
    "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "size": 0
  },
  "layers": [
    {
      "mediaType": "application/vnd.unknown.layer.v1+txt",
      "digest": "sha256:6291bbe45f529c52451285872d5fce81296aafac2190634d6f2e17c08c2e3dcb",
      "size": 44,
      "annotations": {
        "org.opencontainers.image.title": "artifact.txt"
      }
    }
  ]
}

The following code failed as 400 bad request.

src, err := remote.NewRepository("binducentralus.azurecr.io/samples/artifact:1.0")
dest := file.New("temp")
desc, err := oras.Copy(ctx, src, src.Reference.Reference, dest, "")

The problem was the invalid range header value (bytes=0--1) in the download request due to

req.Header.Set("Range", fmt.Sprintf("bytes=0-%d", target.Size-1))
.

@Wwwsylvia Wwwsylvia added the bug Something isn't working label Apr 18, 2022
@wangxiaoxuan273
Copy link
Contributor

Please assign this issue to me, thanks

@shizhMSFT
Copy link
Contributor

Resolved by #145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants