string_validation: Make check_stream_topic merely check, not alter.

Co-authored-by: Shlok Patel <shlokcpatel2001@gmail.com>
This commit is contained in:
Alex Vandiver
2022-01-11 12:54:50 -08:00
parent 1cdb93f6aa
commit 58c8eebda2
2 changed files with 8 additions and 8 deletions

View File

@@ -22,14 +22,11 @@ def check_stream_name(stream_name: str) -> None:
)
def check_stream_topic(topic: str) -> str:
assert topic is not None
topic = topic.strip()
if topic == "":
def check_stream_topic(topic: str) -> None:
if topic.strip() == "":
raise JsonableError(_("Topic can't be empty"))
for character in topic:
unicodeCategory = unicodedata.category(character)
if unicodeCategory in ["Cc", "Cs", "Cn"]:
raise JsonableError(_("Invalid characters in topic!"))
return topic