mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +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 { parseHostTarget } from "@app/lib/parseHostTarget";
|
||||||
import { toASCII, toUnicode } from 'punycode';
|
import { toASCII, toUnicode } from 'punycode';
|
||||||
import { DomainRow } from "../../../../../components/DomainsTable";
|
import { DomainRow } from "../../../../../components/DomainsTable";
|
||||||
|
import { finalizeSubdomainSanitize } from "@app/lib/subdomain-utils";
|
||||||
|
|
||||||
|
|
||||||
const baseResourceFormSchema = z.object({
|
const baseResourceFormSchema = z.object({
|
||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
@@ -326,10 +328,17 @@ export default function Page() {
|
|||||||
http: baseData.http
|
http: baseData.http
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let sanitizedSubdomain: string | undefined;
|
||||||
|
|
||||||
if (isHttp) {
|
if (isHttp) {
|
||||||
const httpData = httpForm.getValues();
|
const httpData = httpForm.getValues();
|
||||||
|
|
||||||
|
sanitizedSubdomain = httpData.subdomain
|
||||||
|
? finalizeSubdomainSanitize(httpData.subdomain)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
Object.assign(payload, {
|
Object.assign(payload, {
|
||||||
subdomain: httpData.subdomain ? toASCII(httpData.subdomain) : undefined,
|
subdomain: sanitizedSubdomain ? toASCII(sanitizedSubdomain) : undefined,
|
||||||
domainId: httpData.domainId,
|
domainId: httpData.domainId,
|
||||||
protocol: "tcp"
|
protocol: "tcp"
|
||||||
});
|
});
|
||||||
@@ -361,6 +370,10 @@ export default function Page() {
|
|||||||
const id = res.data.data.resourceId;
|
const id = res.data.data.resourceId;
|
||||||
setResourceId(id);
|
setResourceId(id);
|
||||||
|
|
||||||
|
toast({
|
||||||
|
description: `Subdomain: ${sanitizedSubdomain}`,
|
||||||
|
});
|
||||||
|
|
||||||
// Create targets if any exist
|
// Create targets if any exist
|
||||||
if (targets.length > 0) {
|
if (targets.length > 0) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user