mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
minor fix to domain sanitize when create resources
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user