wombatu-kun commented on code in PR #16656:
URL: https://github.com/apache/iceberg/pull/16656#discussion_r3353431737


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIO.java:
##########
@@ -331,10 +331,10 @@ public Iterable<FileInfo> listPrefix(String prefix) {
     PrefixedS3Client client = clientForStoragePath(prefix);
 
     S3URI uri = new S3URI(prefix, 
client.s3FileIOProperties().bucketToAccessPointMapping());
-    if (uri.useS3DirectoryBucket()
-        && 
client.s3FileIOProperties().isS3DirectoryBucketListPrefixAsDirectory()) {
-      uri = uri.toDirectoryPath();
-    }
+    // Always normalize the prefix to end with "/" to prevent matching sibling 
prefixes.
+    // Without this, prefix "warehouse/ns/table" would also match 
"warehouse/ns/table_other/...".
+    // This is also required for STS session policies that scope ListBucket to 
"<key>/*".
+    uri = uri.toDirectoryPath();

Review Comment:
   After this change `s3.directory-bucket.list-prefix-as-directory` (default 
true) has no production reader: `isS3DirectoryBucketListPrefixAsDirectory()` is 
now referenced only by a unit test, and `S3URI.useS3DirectoryBucket()` becomes 
production-dead. It also removes the only opt-out that existed for directory 
buckets. Either repurpose the flag to gate this now-unconditional 
normalization, or remove the dead property and its getter from 
`S3FileIOProperties`.



-- 
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.

To unsubscribe, e-mail: [email protected]

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