You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/17 08:26:35 UTC

[GitHub] [hadoop-ozone] mukul1987 commented on a change in pull request #812: HDDS-3161. Block illegal characters when creating keys.

mukul1987 commented on a change in pull request #812: HDDS-3161. Block illegal characters when creating keys.
URL: https://github.com/apache/hadoop-ozone/pull/812#discussion_r410070739
 
 

 ##########
 File path: hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
 ##########
 @@ -196,6 +196,27 @@ public static void verifyResourceName(String... resourceNames) {
     }
   }
 
+  /**
+   * verifies that key name is a valid name.
+   *
+   * @param keyName key name to be validated
+   *
+   * @throws IllegalArgumentException
+   */
+  public static void verifyKeyName(String keyName) {
+    if (keyName == null) {
+      throw new IllegalArgumentException("Key name is null");
+    }
+    String regex = "^[^^{}<>^?%~#`\\[\\]\\|\\\\(\\x80-\\xff)]$";
 
 Review comment:
   Please move this regex to OzoneConsts and please add a simplified example on what characters are not allowed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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