You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "SaketaChalamchala (via GitHub)" <gi...@apache.org> on 2023/08/24 16:34:25 UTC

[GitHub] [ozone] SaketaChalamchala commented on a diff in pull request #5200: HDDS-5161. Fix the regex for key name validation

SaketaChalamchala commented on code in PR #5200:
URL: https://github.com/apache/ozone/pull/5200#discussion_r1304597170


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java:
##########
@@ -427,12 +427,12 @@ private OzoneConsts() {
    * contains illegal characters when creating/renaming key.
    *
    * Avoid the following characters in a key name:
-   * "\", "{", "}", "^", "<", ">", "#", "|", "%", "`", "[", "]", "~", "?"
+   * "\", "{", "}", "<", ">", "^", "?", "%", "~", "#", "|", "`", "[", "]"
    * and Non-printable ASCII characters (128–255 decimal characters).
-   * https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
+   * https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
    */
   public static final Pattern KEYNAME_ILLEGAL_CHARACTER_CHECK_REGEX  =
-          Pattern.compile("^[^^{}<>^?%~#`\\[\\]\\|\\\\(\\x80-\\xff)]+$");
+          Pattern.compile("^[^\\\\{}<>^?%~#|`\\[\\]\\x80-\\xff]+$");

Review Comment:
   Thanks for the patch @Tejaskriya. According to the [documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) `?` need not be avoided and  quotation marks `"` should be avoided. Could you incorporate this in the regex. 
   Could you add tests for all cases in https://github.com/apache/ozone/blob/011de37b19ec874819ae5bbf726580ba5b0b7f93/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestHddsClientUtils.java#L273



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