From 2f89a1685213863156d02754bd09ce725340ecd4 Mon Sep 17 00:00:00 2001 From: Pallavi Date: Fri, 5 Sep 2025 20:39:50 +0530 Subject: [PATCH] minor fix to domain sanitize when create resources --- .../[orgId]/settings/resources/create/page.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/[orgId]/settings/resources/create/page.tsx b/src/app/[orgId]/settings/resources/create/page.tsx index 06ecfed9..ad0a6568 100644 --- a/src/app/[orgId]/settings/resources/create/page.tsx +++ b/src/app/[orgId]/settings/resources/create/page.tsx @@ -91,6 +91,8 @@ import { DockerManager, DockerState } from "@app/lib/docker"; import { parseHostTarget } from "@app/lib/parseHostTarget"; import { toASCII, toUnicode } from 'punycode'; import { DomainRow } from "../../../../../components/DomainsTable"; +import { finalizeSubdomainSanitize } from "@app/lib/subdomain-utils"; + const baseResourceFormSchema = z.object({ name: z.string().min(1).max(255), @@ -326,10 +328,17 @@ export default function Page() { http: baseData.http }; + let sanitizedSubdomain: string | undefined; + if (isHttp) { const httpData = httpForm.getValues(); + + sanitizedSubdomain = httpData.subdomain + ? finalizeSubdomainSanitize(httpData.subdomain) + : undefined; + Object.assign(payload, { - subdomain: httpData.subdomain ? toASCII(httpData.subdomain) : undefined, + subdomain: sanitizedSubdomain ? toASCII(sanitizedSubdomain) : undefined, domainId: httpData.domainId, protocol: "tcp" }); @@ -361,6 +370,10 @@ export default function Page() { const id = res.data.data.resourceId; setResourceId(id); + toast({ + description: `Subdomain: ${sanitizedSubdomain}`, + }); + // Create targets if any exist if (targets.length > 0) { try {