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

GenerateDescriptorAsync doesn't use the correct header property #133

Closed
1 task done
daniel-pebble opened this issue Aug 7, 2024 · 2 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@daniel-pebble
Copy link
Contributor

What happened in your code base?

When attempting to use FetchAsync to download a manifest it fails as Oras isn't looking at the correct location for the "Docker-Content-Digest" header.

I've adjusted the code to check both response.Content.Headers and response.Headers and in my tests its always on response.Headers.

What did you expect to happen?

Content digest is found in the correct header location

How can we reproduce it?

if (response.Content.Headers.TryGetValues("Docker-Content-Digest", out var serverContentHeaderDigest))
{
    serverDigest = serverContentHeaderDigest.FirstOrDefault();
    if (!string.IsNullOrEmpty(serverDigest))
    {
        response.VerifyContentDigest(serverDigest);
    }
}

if (response.Headers.TryGetValues("Docker-Content-Digest", out var serverHeaderDigest))
{
    serverDigest = serverHeaderDigest.FirstOrDefault();
    if (!string.IsNullOrEmpty(serverDigest))
    {
        response.VerifyContentDigest(serverDigest);
    }
}

What is the version or commit of the ORAS .NET library?

Commit: c58adc9

What are your OS and Runtime environments?

Windows 11 .net 8

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.
@daniel-pebble daniel-pebble added bug Something isn't working triage New issues or PRs to be acknowledged by maintainers labels Aug 7, 2024
@Wwwsylvia
Copy link
Member

Hi @daniel-pebble, thanks for the issue!

I've adjusted the code to check both response.Content.Headers and response.Headers and in my tests its always on response.Headers.

I just took a look at the Azure .NET SDK and found that response.Headers is checked there.

rawResponse.Headers.TryGetValue("Docker-Content-Digest", out string responseHeaderDigest);

Would you like to go ahead and create a PR to fix this?

daniel-pebble added a commit to daniel-pebble/oras-dotnet that referenced this issue Aug 9, 2024
While testing against https://hub.docker.com/_/registry, "Docker-Content-Digest" headers were found on response.Headers collection rather than response.Content.Headers.
Aligned internal/private variables to use _camelCase as there was some inconsistencies.
daniel-pebble added a commit to daniel-pebble/oras-dotnet that referenced this issue Aug 9, 2024
While testing against https://hub.docker.com/_/registry, "Docker-Content-Digest" headers were found on response.Headers collection rather than response.Content.Headers.
Aligned internal/private variables to use _camelCase as there was some inconsistencies.

Signed-off-by: Daniel Robinson <daniel.robinson@pebble.tv>
daniel-pebble added a commit to daniel-pebble/oras-dotnet that referenced this issue Aug 9, 2024
While testing against https://hub.docker.com/_/registry, "Docker-Content-Digest" headers were found on response.Headers collection rather than response.Content.Headers.
Aligned internal/private variables to use _camelCase as there was some inconsistencies.

Signed-off-by: Daniel Robinson <daniel.robinson@pebble.tv>
daniel-pebble added a commit to daniel-pebble/oras-dotnet that referenced this issue Aug 9, 2024
While testing against https://hub.docker.com/_/registry, "Docker-Content-Digest" headers were found on response.Headers collection rather than response.Content.Headers.
Aligned internal/private variables to use _camelCase as there was some inconsistencies.

Signed-off-by: Daniel Robinson <daniel.robinson@pebble.tv>
@shizhMSFT shizhMSFT removed the triage New issues or PRs to be acknowledged by maintainers label Aug 10, 2024
@shizhMSFT
Copy link
Contributor

Closed by #136

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
3 participants