mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-23 21:36:37 +00:00
ensure subdomain is null if is base domain
This commit is contained in:
@@ -35,8 +35,8 @@ const createHttpResourceSchema = z
|
||||
name: z.string().min(1).max(255),
|
||||
subdomain: z
|
||||
.string()
|
||||
.optional()
|
||||
.transform((val) => val?.toLowerCase()),
|
||||
.nullable()
|
||||
.optional(),
|
||||
siteId: z.number(),
|
||||
http: z.boolean(),
|
||||
protocol: z.enum(["tcp", "udp"]),
|
||||
@@ -201,7 +201,8 @@ async function createHttpResource(
|
||||
);
|
||||
}
|
||||
|
||||
const { name, subdomain, domainId } = parsedBody.data;
|
||||
const { name, domainId } = parsedBody.data;
|
||||
let subdomain = parsedBody.data.subdomain;
|
||||
|
||||
const [domainRes] = await db
|
||||
.select()
|
||||
@@ -274,6 +275,10 @@ async function createHttpResource(
|
||||
}
|
||||
}
|
||||
|
||||
if (fullDomain === domainRes.domains.baseDomain) {
|
||||
subdomain = null;
|
||||
}
|
||||
|
||||
fullDomain = fullDomain.toLowerCase();
|
||||
|
||||
logger.debug(`Full domain: ${fullDomain}`);
|
||||
|
||||
Reference in New Issue
Block a user