From ca5c51a71210ea7e92a7de9d03d32bc76e2a02bd Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 18 Jun 2025 16:50:17 -0400 Subject: [PATCH] fix: Client and server validation differ for subdomains (#9468) * fix: Client and server validation differ for subdomains * Validation message * Lower min subdomain length to 2 --- app/scenes/Settings/Details.tsx | 9 +++++++-- server/models/Team.ts | 12 ++++++++---- shared/validations.ts | 9 +++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/scenes/Settings/Details.tsx b/app/scenes/Settings/Details.tsx index b4b94eaed3..90506fa7c8 100644 --- a/app/scenes/Settings/Details.tsx +++ b/app/scenes/Settings/Details.tsx @@ -10,6 +10,7 @@ import { ThemeProvider, useTheme } from "styled-components"; import { buildDarkTheme, buildLightTheme } from "@shared/styles/theme"; import { CustomTheme, TOCPosition, TeamPreference } from "@shared/types"; import { getBaseDomain } from "@shared/utils/domains"; +import { TeamValidation } from "@shared/validations"; import Button from "~/components/Button"; import ButtonLink from "~/components/ButtonLink"; import DefaultCollectionInputSelect from "~/components/DefaultCollectionInputSelect"; @@ -322,8 +323,12 @@ function Details() { value={subdomain || ""} onChange={handleSubdomainChange} autoComplete="off" - minLength={4} - maxLength={32} + minLength={TeamValidation.minSubdomainLength} + maxLength={ + isCloudHosted + ? TeamValidation.maxSubdomainLength + : TeamValidation.maxSubdomainSelfHostedLength + } />