Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKian committed Apr 10, 2024
1 parent 02434a4 commit a489647
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hstream-kafka/HStream/Kafka/Server/Handler/Topic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 '-'"
Expand Down

0 comments on commit a489647

Please sign in to comment.