@@ -354,6 +354,7 @@ public Manifest pushArtifact(
354354 public Layer pushBlob (ContainerRef containerRef , Path blob , Map <String , String > annotations ) {
355355 String digest = containerRef .getAlgorithm ().digest (blob );
356356 LOG .debug ("Digest: {}" , digest );
357+ // This migh not works with registries performing HEAD request
357358 if (hasBlob (containerRef .withDigest (digest ))) {
358359 LOG .info ("Blob already exists: {}" , digest );
359360 return Layer .fromFile (blob , containerRef .getAlgorithm ()).withAnnotations (annotations );
@@ -491,9 +492,6 @@ private HttpClient.ResponseWrapper<String> headBlob(ContainerRef containerRef) {
491492 */
492493 @ Override
493494 public byte [] getBlob (ContainerRef containerRef ) {
494- if (!hasBlob (containerRef )) {
495- throw new OrasException (new HttpClient .ResponseWrapper <>("" , 404 , Map .of ()));
496- }
497495 URI uri = URI .create (
498496 "%s://%s" .formatted (getScheme (), containerRef .forRegistry (this ).getBlobsPath (this )));
499497 HttpClient .ResponseWrapper <String > response = client .get (
@@ -510,9 +508,6 @@ public byte[] getBlob(ContainerRef containerRef) {
510508
511509 @ Override
512510 public void fetchBlob (ContainerRef containerRef , Path path ) {
513- if (!hasBlob (containerRef )) {
514- throw new OrasException (new HttpClient .ResponseWrapper <>("" , 404 , Map .of ()));
515- }
516511 URI uri = URI .create (
517512 "%s://%s" .formatted (getScheme (), containerRef .forRegistry (this ).getBlobsPath (this )));
518513 HttpClient .ResponseWrapper <Path > response = client .download (
@@ -528,9 +523,6 @@ public void fetchBlob(ContainerRef containerRef, Path path) {
528523
529524 @ Override
530525 public InputStream fetchBlob (ContainerRef containerRef ) {
531- if (!hasBlob (containerRef )) {
532- throw new OrasException (new HttpClient .ResponseWrapper <>("" , 404 , Map .of ()));
533- }
534526 URI uri = URI .create (
535527 "%s://%s" .formatted (getScheme (), containerRef .forRegistry (this ).getBlobsPath (this )));
536528 HttpClient .ResponseWrapper <InputStream > response = client .download (
0 commit comments