mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
fix: automatically converting username to lowercase both in creation of register, and build for extra. (#4382)
This commit is contained in:
@@ -44,6 +44,13 @@ export const registryRelations = relations(registry, ({ many }) => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Image references require a lowercase namespace (e.g. Docker Hub username).
|
||||||
|
const registryUsernameSchema = z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1)
|
||||||
|
.transform((s) => s.toLowerCase());
|
||||||
|
|
||||||
// Registry URLs must be hostname[:port] only — no shell metacharacters
|
// Registry URLs must be hostname[:port] only — no shell metacharacters
|
||||||
// Empty string is allowed (means default/Docker Hub registry)
|
// Empty string is allowed (means default/Docker Hub registry)
|
||||||
const registryUrlSchema = z
|
const registryUrlSchema = z
|
||||||
@@ -57,7 +64,7 @@ const registryUrlSchema = z
|
|||||||
|
|
||||||
const createSchema = createInsertSchema(registry, {
|
const createSchema = createInsertSchema(registry, {
|
||||||
registryName: z.string().min(1),
|
registryName: z.string().min(1),
|
||||||
username: z.string().min(1),
|
username: registryUsernameSchema,
|
||||||
password: z.string().min(1),
|
password: z.string().min(1),
|
||||||
registryUrl: registryUrlSchema,
|
registryUrl: registryUrlSchema,
|
||||||
organizationId: z.string().min(1),
|
organizationId: z.string().min(1),
|
||||||
@@ -70,7 +77,7 @@ export const apiCreateRegistry = createSchema
|
|||||||
.pick({})
|
.pick({})
|
||||||
.extend({
|
.extend({
|
||||||
registryName: z.string().min(1),
|
registryName: z.string().min(1),
|
||||||
username: z.string().min(1),
|
username: registryUsernameSchema,
|
||||||
password: z.string().min(1),
|
password: z.string().min(1),
|
||||||
registryUrl: registryUrlSchema,
|
registryUrl: registryUrlSchema,
|
||||||
registryType: z.enum(["cloud"]),
|
registryType: z.enum(["cloud"]),
|
||||||
@@ -83,7 +90,7 @@ export const apiCreateRegistry = createSchema
|
|||||||
|
|
||||||
export const apiTestRegistry = createSchema.pick({}).extend({
|
export const apiTestRegistry = createSchema.pick({}).extend({
|
||||||
registryName: z.string().optional(),
|
registryName: z.string().optional(),
|
||||||
username: z.string().min(1),
|
username: registryUsernameSchema,
|
||||||
password: z.string().min(1),
|
password: z.string().min(1),
|
||||||
registryUrl: registryUrlSchema,
|
registryUrl: registryUrlSchema,
|
||||||
registryType: z.enum(["cloud"]),
|
registryType: z.enum(["cloud"]),
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ export const getRegistryTag = (registry: Registry, imageName: string) => {
|
|||||||
// Extract the repository name (last part after '/')
|
// Extract the repository name (last part after '/')
|
||||||
const repositoryName = extractRepositoryName(imageName);
|
const repositoryName = extractRepositoryName(imageName);
|
||||||
|
|
||||||
// Build the final tag using registry's username/prefix
|
// Build the final tag using registry's username/prefix (must be lowercase for valid image refs)
|
||||||
const targetPrefix = imagePrefix || username;
|
const targetPrefix = (imagePrefix || username).toLowerCase();
|
||||||
const finalRegistry = registryUrl || "";
|
const finalRegistry = registryUrl || "";
|
||||||
|
|
||||||
return finalRegistry
|
return finalRegistry
|
||||||
|
|||||||
Reference in New Issue
Block a user