[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-06-29 20:11:18 +00:00
committed by GitHub
parent df6a72ea50
commit fac96b5db5
3 changed files with 34 additions and 11 deletions

View File

@@ -92,12 +92,17 @@ export const domain = z
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["stripPath"],
message: "Strip path can only be enabled when a path other than '/' is specified",
message:
"Strip path can only be enabled when a path other than '/' is specified",
});
}
// Validate internalPath starts with /
if (input.internalPath && input.internalPath !== "/" && !input.internalPath.startsWith("/")) {
if (
input.internalPath &&
input.internalPath !== "/" &&
!input.internalPath.startsWith("/")
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["internalPath"],

View File

@@ -37,12 +37,17 @@ export const domain = z
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["stripPath"],
message: "Strip path can only be enabled when a path other than '/' is specified",
message:
"Strip path can only be enabled when a path other than '/' is specified",
});
}
// Validate internalPath starts with /
if (input.internalPath && input.internalPath !== "/" && !input.internalPath.startsWith("/")) {
if (
input.internalPath &&
input.internalPath !== "/" &&
!input.internalPath.startsWith("/")
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["internalPath"],
@@ -89,12 +94,17 @@ export const domainCompose = z
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["stripPath"],
message: "Strip path can only be enabled when a path other than '/' is specified",
message:
"Strip path can only be enabled when a path other than '/' is specified",
});
}
// Validate internalPath starts with /
if (input.internalPath && input.internalPath !== "/" && !input.internalPath.startsWith("/")) {
if (
input.internalPath &&
input.internalPath !== "/" &&
!input.internalPath.startsWith("/")
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["internalPath"],

View File

@@ -302,7 +302,7 @@ export const createDomainLabels = (
path,
customCertResolver,
stripPath,
internalPath
internalPath,
} = domain;
const routerName = `${appName}-${uniqueConfigKey}-${entrypoint}`;
const labels = [
@@ -315,20 +315,28 @@ export const createDomainLabels = (
// Validate stripPath - it should only be used when path is defined and not "/"
if (stripPath) {
if (!path || path === "/") {
console.warn(`stripPath is enabled but path is not defined or is "/" for domain ${host}`);
console.warn(
`stripPath is enabled but path is not defined or is "/" for domain ${host}`,
);
} else {
const middlewareName = `stripprefix-${appName}-${uniqueConfigKey}`;
labels.push(`traefik.http.middlewares.${middlewareName}.stripprefix.prefixes=${path}`);
labels.push(
`traefik.http.middlewares.${middlewareName}.stripprefix.prefixes=${path}`,
);
}
}
// Validate internalPath - ensure it's a valid path format
if (internalPath && internalPath !== "/") {
if (!internalPath.startsWith("/")) {
console.warn(`internalPath "${internalPath}" should start with "/" and not be empty for domain ${host}`);
console.warn(
`internalPath "${internalPath}" should start with "/" and not be empty for domain ${host}`,
);
} else {
const middlewareName = `addprefix-${appName}-${uniqueConfigKey}`;
labels.push(`traefik.http.middlewares.${middlewareName}.addprefix.prefix=${internalPath}`);
labels.push(
`traefik.http.middlewares.${middlewareName}.addprefix.prefix=${internalPath}`,
);
}
}