This is an automated email from the ASF dual-hosted git repository.
siyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 58cdce191a HDDS-8920. Ozone is supporting unicode volume and bucket
names, unintentionally (#5276)
58cdce191a is described below
commit 58cdce191ad91c54a55a71ca76515229a034af88
Author: Tejaskriya <[email protected]>
AuthorDate: Thu Sep 14 03:10:36 2023 +0530
HDDS-8920. Ozone is supporting unicode volume and bucket names,
unintentionally (#5276)
Co-authored-by: tejaskriya <[email protected]>
---
.../org/apache/hadoop/hdds/scm/client/HddsClientUtils.java | 13 ++++++++++---
.../org/apache/hadoop/ozone/client/TestHddsClientUtils.java | 2 ++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
index f744737aef..e7528c2d08 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
@@ -132,9 +132,16 @@ public final class HddsClientUtils {
// ozone allows namespace to follow other volume/bucket naming convention,
// for example, here supports '_',
// which is a valid character in POSIX-compliant system, like HDFS.
- return (c == '.' || c == '-' ||
- Character.isLowerCase(c) || Character.isDigit(c)) ||
- (c == '_' && !isStrictS3);
+ if (c >= '0' && c <= '9') {
+ return true;
+ } else if (c >= 'a' && c <= 'z') {
+ return true;
+ } else if (c == '-' || c == '.') {
+ return true;
+ } else if (c == '_' && !isStrictS3) {
+ return true;
+ }
+ return false;
}
private static void doCharacterChecks(char currChar, char prev,
diff --git
a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestHddsClientUtils.java
b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestHddsClientUtils.java
index 0ee211f3d5..dcc5fec551 100644
---
a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestHddsClientUtils.java
+++
b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestHddsClientUtils.java
@@ -246,6 +246,7 @@ public class TestHddsClientUtils {
final String upperCase = "notAname";
final String endDot = "notaname.";
final String startDot = ".notaname";
+ final String unicodeCharacters = "zzz";
final String tooShort = StringUtils.repeat("a",
OzoneConsts.OZONE_MIN_BUCKET_NAME_LENGTH - 1);
@@ -257,6 +258,7 @@ public class TestHddsClientUtils {
invalidNames.add(upperCase);
invalidNames.add(endDot);
invalidNames.add(startDot);
+ invalidNames.add(unicodeCharacters);
invalidNames.add(tooShort);
for (String name : invalidNames) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]