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

fix: check content-type when using referrers API #635

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

ktarplee
Copy link
Contributor

@ktarplee ktarplee commented Nov 6, 2023

When accessing the referrer's API, this adds a check to make sure the content-type is an OCI index.

Also fixes the tests to properly set the content-type header in the response.

Closes #633

@ktarplee
Copy link
Contributor Author

ktarplee commented Nov 13, 2023

@Wwwsylvia @shizhMSFT This is ready from my perspective. Once you review the PR I can rebase if desired.

@ktarplee ktarplee force-pushed the 633-referrers-content-type branch 2 times, most recently from ffed3d8 to fc50894 Compare November 16, 2023 11:05
@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3776676) 75.20% compared to head (c14305f) 75.23%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #635      +/-   ##
==========================================
+ Coverage   75.20%   75.23%   +0.03%     
==========================================
  Files          59       59              
  Lines        5473     5480       +7     
==========================================
+ Hits         4116     4123       +7     
  Misses       1001     1001              
  Partials      356      356              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ktarplee
Copy link
Contributor Author

@shizhMSFT Can we get this merged?

@Wwwsylvia
Copy link
Member

Just back from some other work, sorry for the delay! I'm reviewing it.

registry/remote/repository.go Outdated Show resolved Hide resolved
registry/remote/repository.go Outdated Show resolved Hide resolved
registry/remote/repository.go Outdated Show resolved Hide resolved
@ktarplee
Copy link
Contributor Author

@Wwwsylvia I liked you changes. I tested them and it still resolves the original issue. Let me know if there are any other changes or if you want me to squash the commits.

Return an ErrUnsupported to when the referrers API is not supported.

Signed-off-by: Kyle M. Tarplee <kmtarplee@ieee.org>
@ktarplee
Copy link
Contributor Author

@Wwwsylvia @shizhMSFT This is rebased and should be ready to be merged.

Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Wwwsylvia Wwwsylvia merged commit 79a08b4 into oras-project:main Nov 21, 2023
7 checks passed
@Wwwsylvia Wwwsylvia mentioned this pull request Jan 26, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repository.Referrers does not properly detect the absence of the referrers API for registry.k8s.io
4 participants