Skip to content

Commit 6613cb7

Browse files
authored
Merge pull request #2921 from Harikrishnan1367709/Container-not-started-if-the-Volume-contains-spaces-#2916
feat(volumes): block spaces/quotes in volume names (#2916)
2 parents 75a4389 + 94c0031 commit 6613cb7

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

apps/dokploy/components/dashboard/application/advanced/volumes/add-volumes.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ const mySchema = z.discriminatedUnion("type", [
5959
z
6060
.object({
6161
type: z.literal("volume"),
62-
volumeName: z.string().min(1, "Volume name required"),
62+
volumeName: z
63+
.string()
64+
.min(1, "Volume name required")
65+
.regex(
66+
/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/,
67+
"Invalid volume name. Use letters, numbers, '._-' and start with a letter/number.",
68+
),
6369
})
6470
.merge(mountSchema),
6571
z

apps/dokploy/components/dashboard/application/advanced/volumes/update-volume.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ const mySchema = z.discriminatedUnion("type", [
4141
z
4242
.object({
4343
type: z.literal("volume"),
44-
volumeName: z.string().min(1, "Volume name required"),
44+
volumeName: z
45+
.string()
46+
.min(1, "Volume name required")
47+
.regex(
48+
/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/,
49+
"Invalid volume name. Use letters, numbers, '._-' and start with a letter/number.",
50+
),
4551
})
4652
.merge(mountSchema),
4753
z

apps/dokploy/components/dashboard/application/volume-backups/handle-volume-backups.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ const formSchema = z
4747
.object({
4848
name: z.string().min(1, "Name is required"),
4949
cronExpression: z.string().min(1, "Cron expression is required"),
50-
volumeName: z.string().min(1, "Volume name is required"),
50+
volumeName: z
51+
.string()
52+
.min(1, "Volume name is required")
53+
.regex(
54+
/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/,
55+
"Invalid volume name. Use letters, numbers, '._-' and start with a letter/number.",
56+
),
5157
prefix: z.string(),
5258
keepLatestCount: z.coerce
5359
.number()

0 commit comments

Comments
 (0)