Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

demo-orgs: Limit random subdomain to MAX_REALM_SUBDOMAIN_LENGTH.

Lauryn Menard069a1de98834
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index 3623f8790fe..4b35fe6c342 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -1430,6 +1430,8 @@ def generate_demo_realm_subdomain() -> str:
adjective = random.SystemRandom().choice(demo_organization_words["adjectives"])
noun = random.SystemRandom().choice(demo_organization_words["nouns"])
demo_subdomain = f"{adverb}-{adjective}-{noun}"
+ if len(demo_subdomain) > Realm.MAX_REALM_SUBDOMAIN_LENGTH: # nocoverage
+ continue
try:
check_subdomain_available(demo_subdomain)
break