Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

zw428
Copy link
Contributor

@zw428 zw428 commented Jun 16, 2025

The spec says the follow-up PUT should be ?digest=, not &digest=. The former is also incorrect query param syntax.

This causes Google Artifact Registry to return a 404. I tested by changing this to a ? and got a 201 instead of a 404.

Description

This is a fix for #319.

Note: I get IllegalState Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration for some tests in OCILayoutTest and RegistryTest. I have colima running on macOS. I didn't see any instructions for getting this set up.

Testing done

I tested running this against GCP Artifact Registry and received a 201 where I was previously receiving a 404.

Submitter checklist

  • I have read and understood the CONTRIBUTING guide
  • I have run mvn license:update-file-header, mvn spotless:apply, pre-commit run -a, mvn clean install before opening the PR
    • See note above on some tests failing

@jonesbusy
Copy link
Collaborator

Thanks! This look valid.

But for some reason it cause some regression on one test

 Error:  land.oras.RegistryTest.testShouldCopySingleArtifactFromRegistryIntoRegistry -- Time elapsed: 11.71 s <<< ERROR!
land.oras.exception.OrasException: 
Failed to push layer: {"errors":[{"code":"BLOB_UPLOAD_INVALID","message":"blob upload invalid","detail":"illegal base64 data at input byte 224"}]}

Tests are using testcontainer. There run with docker on GH action and I run them using podman on Linux. It don't know about other environment

@jonesbusy
Copy link
Collaborator

I see the issue. If fact we need better parsing of the URI

The ZOT container return a location with a query param (the digest is ignored since it's added)

http://localhost:32773/v2/library/artifact-target/blobs/uploads/bb5cf00d-7235-4f74-a30c-ff9a1dd5818c?_state=_8NTpwKt5E1X0D7HmHr2_r11f1eLW4_F_KXE01_ir5x7Ik5hbWUiOiJsaWJyYXJ5L2FydGlmYWN0LXRhcmdldCIsIlVVSUQiOiJiYjVjZjAwZC03MjM1LTRmNzQtYTMwYy1mZjlhMWRkNTgxOGMiLCJPZmZzZXQiOjAsIlN0YXJ0ZWRBdCI6IjIwMjUtMDYtMTZUMTY6NTc6MzIuMTE3NDgxMTcyWiJ9?digest=sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 

So this will fix some registry but broke some other

Copy link
Collaborator

@jonesbusy jonesbusy left a comment

Choose a reason for hiding this comment

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

We need better parsing of the Location to ensure to append the query param correctly

@zw428 zw428 force-pushed the fix-registry-digest-query-param-malformed branch from 325ea75 to bfb03ee Compare June 16, 2025 18:50
The spec says the follow-up PUT should be <location>?digest=<digest>,
not <location>&digest=<digest>. The former is also incorrect query param
syntax.

This causes Google Artifact Registry to return a 404. I tested by
changing this to a ? and got a 201 instead of a 404.

Signed-off-by: Zack Warnimont <[email protected]>
@zw428 zw428 force-pushed the fix-registry-digest-query-param-malformed branch from bfb03ee to 9c29b8b Compare June 16, 2025 18:56
@zw428
Copy link
Contributor Author

zw428 commented Jun 16, 2025

The commit I just pushed should be passing CI now, I was able to get it running locally. I wasn't sure the best place to write a unit test for this. If you have a suggestion let me know and I'll be happy to write it up.

Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.91%. Comparing base (da55586) to head (9c29b8b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/main/java/land/oras/Registry.java 80.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #320      +/-   ##
============================================
- Coverage     87.96%   87.91%   -0.06%     
- Complexity      615      617       +2     
============================================
  Files            39       39              
  Lines          1878     1886       +8     
  Branches        207      208       +1     
============================================
+ Hits           1652     1658       +6     
- Misses          133      135       +2     
  Partials         93       93              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonesbusy
Copy link
Collaborator

Thanks, looks both branches are already covered.

Method could be private but not blocking.

Do you need a release I guess?

If yes I can perform one tomorrow

@jonesbusy jonesbusy merged commit 412ad9f into oras-project:main Jun 16, 2025
4 checks passed
@zw428
Copy link
Contributor Author

zw428 commented Jun 16, 2025

@jonesbusy a release tomorrow would be extremely helpful, thank you!! 😄

@zw428 zw428 deleted the fix-registry-digest-query-param-malformed branch June 16, 2025 19:40
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

Successfully merging this pull request may close these issues.

2 participants