You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "iprithv (via GitHub)" <gi...@apache.org> on 2026/10/10 14:55:22 UTC

[PR] HDDS-16835: Remove unreachable endsWith branch in S3 ListObjects [ozone]

iprithv opened a new pull request, #11467:
URL: https://github.com/apache/ozone/pull/11467

   `else if (relativekeyname.endswith(delimiter))` condition can never run. it is only reached when `relativekeyname` does not contain the delimiter, so it cannot end with it either.
   
   the case it was meant for (prefix `dir`, key `dir/`) is already handled by the `indexof(delimiter)` branch, which adds the common prefix `dir/`.
   
   so removed the unreachable branch.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #11467:
URL: https://github.com/apache/ozone/pull/11467


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #11467:
URL: https://github.com/apache/ozone/pull/11467#issuecomment-6101860351

   sure, done @Russole. thanks for checking this!


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835: Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #11467:
URL: https://github.com/apache/ozone/pull/11467#issuecomment-6098825434

   resolves https://issues.apache.org/jira/browse/HDDS-16835


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "F64116045 (via GitHub)" <gi...@apache.org>.
F64116045 commented on code in PR #11467:
URL: https://github.com/apache/ozone/pull/11467#discussion_r4238192292


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketList.java:
##########
@@ -99,6 +99,25 @@ public void listDir() throws OS3Exception, IOException {
     assertEquals(0, getBucketResponse.getContents().size());
   }
 
+  /**
+   * Key equal to prefix + delimiter (dir/ with prefix dir) is handled by the
+   * indexOf(delimiter) branch as a common prefix. An endsWith(delimiter)
+   * fallback after indexOf &lt; 0 is unreachable and must not be required.
+   */
+  @Test
+  public void listExactPrefixWithTrailingDelimiter() throws OS3Exception, IOException {
+    setup("dir/", "dir/file1", "other");

Review Comment:
   nit: I think this test does not really check the `dir/` key.
   `dir/file1` alone already gives the common prefix `dir/`, so the
   test passes even if `dir/` is removed from setup.
   
   Maybe use `setup("dir/", "other")` instead?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "F64116045 (via GitHub)" <gi...@apache.org>.
F64116045 commented on code in PR #11467:
URL: https://github.com/apache/ozone/pull/11467#discussion_r4240529156


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketList.java:
##########
@@ -99,6 +99,25 @@ public void listDir() throws OS3Exception, IOException {
     assertEquals(0, getBucketResponse.getContents().size());
   }
 
+  /**
+   * Key equal to prefix + delimiter (dir/ with prefix dir) is handled by the
+   * indexOf(delimiter) branch as a common prefix. An endsWith(delimiter)

Review Comment:
   one more small thing I just noticed
   after this PR is merged, there is no `endsWith` in the code anymore, so the second sentence may confuse future readers. 
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #11467:
URL: https://github.com/apache/ozone/pull/11467#issuecomment-6099387788

   thanks for the quick review! updatd the title, description and test, and enabled actions on the fork..


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16835. Remove unreachable endsWith branch in S3 ListObjects [ozone]

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on PR #11467:
URL: https://github.com/apache/ozone/pull/11467#issuecomment-6132887432

   Thanks @iprithv for the patch. Thanks @F64116045 @Russole for the reviews.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org