Gargi-jais11 commented on code in PR #10930:
URL: https://github.com/apache/ozone/pull/10930#discussion_r3709466501
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -810,6 +812,23 @@ protected static CheckedRunnable<IOException>
validateContentLength(
};
}
+ /**
+ * Reject directory keys accessed without a trailing slash when FSO
directory creation is enabled.
+ *
+ * <p>Necessary for directories in buckets with FSO layout. Intended for
apps which use Hadoop S3A
+ * (e.g. Trino through the Hive connector).
+ */
+ protected void isFile(String keyPath, OzoneKey key) throws OMException {
+ boolean isFsoDirCreationEnabled = getOzoneConfiguration()
+ .getBoolean(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED,
+ OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED_DEFAULT);
+ if (isFsoDirCreationEnabled &&
+ !key.isFile() &&
+ !keyPath.endsWith("/")) {
Review Comment:
No — for FSO directory keys, **isFile()** is false. A file key has
`isFile()==true`. the trailing-slash check only gates directory access without
/.
--
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]