rdblue commented on a change in pull request #1863:
URL: https://github.com/apache/iceberg/pull/1863#discussion_r535415969



##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/BaseS3File.java
##########
@@ -75,13 +76,14 @@ public boolean exists() {
     }
   }
 
-  protected HeadObjectResponse getObjectMetadata() throws S3Exception {
+  protected S3Object getObjectMetadata() throws S3Exception {
     if (metadata == null) {
-      HeadObjectRequest.Builder requestBuilder = HeadObjectRequest.builder()
+      ListObjectsV2Response response = 
client().listObjectsV2(ListObjectsV2Request.builder()
           .bucket(uri().bucket())
-          .key(uri().key());
-      S3RequestUtil.configureEncryption(awsProperties, requestBuilder);
-      metadata = client().headObject(requestBuilder.build());
+          .prefix(uri().key())
+          .maxKeys(1)
+          .build());
+      metadata = response.hasContents() ? response.contents().get(0) : null;

Review comment:
       I agree, `NotFoundException` would be much better.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to