Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ target/
oci/
!src/test/resources/oci/
!src/test/resources/oci/**/*.json
!src/test/resources/archives/*.zip
8 changes: 4 additions & 4 deletions src/main/java/land/oras/Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public Layer pushBlob(ContainerRef containerRef, Path blob, Map<String, String>
LOG.debug("Digest: {}", digest);
ContainerRef ref = containerRef.forRegistry(this).checkBlocked(this);
if (ref.isInsecure(this) && !this.isInsecure()) {
return asInsecure().pushBlob(containerRef, blob, annotations);
return asInsecure().pushBlob(ref, blob, annotations);
}
// This might not works with registries performing HEAD request
if (hasBlob(ref.withDigest(digest))) {
Expand Down Expand Up @@ -453,8 +453,8 @@ public Layer pushBlob(ContainerRef containerRef, Path blob, Map<String, String>
String location = response.headers().get(Const.LOCATION_HEADER.toLowerCase());
// Ensure location is absolute URI
if (!location.startsWith("http") && !location.startsWith("https")) {
location = "%s://%s/%s"
.formatted(getScheme(), containerRef.getApiRegistry(this), location.replaceFirst("^/", ""));
location =
"%s://%s/%s".formatted(getScheme(), ref.getApiRegistry(this), location.replaceFirst("^/", ""));
}
LOG.debug("Location header: {}", location);

Expand All @@ -465,7 +465,7 @@ public Layer pushBlob(ContainerRef containerRef, Path blob, Map<String, String>
uploadURI,
Map.of(Const.CONTENT_TYPE_HEADER, Const.APPLICATION_OCTET_STREAM_HEADER_VALUE),
blob,
Scopes.of(this, containerRef),
Scopes.of(this, ref),
authProvider);
if (response.statusCode() == 201) {
LOG.debug("Successful push: {}", response.response());
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/land/oras/HarborS3ITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void shouldPushFluxArtifact() {

// The compressed manifests
Path archive = Paths.get("src/test/resources/archives").resolve("flux-manifests.tgz");
Path image = Paths.get("src/test/resources/img").resolve("opentofu.png");
Path image = Paths.get("src/test/resources/img").resolve("flux-cd.png");
String configMediaType = "application/vnd.cncf.flux.config.v1+json";
String contentMediaType = "application/vnd.cncf.flux.content.v1.tar+gzip";

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/land/oras/OpenTofuITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void shouldAssembleProviderArtifact() {
ArtifactType manifestArtifactType = ArtifactType.from("application/vnd.opentofu.provider-target");
String contentMediaType = "archive/zip";

Path image = Paths.get("src/test/resources/img").resolve("flux-cd.png");
Path image = Paths.get("src/test/resources/img").resolve("opentofu.png");

Platform linuxAmd64 = Platform.linuxAmd64();

Expand Down
Binary file not shown.