From a4896479f18dd5fc3652cdef706a61a3996f3112 Mon Sep 17 00:00:00 2001 From: YangKian <1207783292@qq.com> Date: Wed, 10 Apr 2024 13:36:55 +0800 Subject: [PATCH] update --- hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs b/hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs index 9f2df9447..327f62875 100644 --- a/hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs +++ b/hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs @@ -154,8 +154,13 @@ validateTopicName name where maxNameLength = 249 - validChars = ['a'..'z'] <> ['A'..'Z'] <> ['0'..'9'] <> ['_', '-', '.'] - containsValidChars = T.all (`elem` validChars) + containsValidChars = T.all isValidChar + isValidChar c = (c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9') + || c == '.' + || c == '_' + || c == '-' topicNameTooLong n = Just $ "the lenght of " <> n <> " is longer than the max allowd length " <> (T.pack . show $ maxNameLength) invalidChars n = Just $ n <> " contains one or more characters other than ASCII alphanumeric, '.', '_', and '-'"