Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Allow forward slashes for branch names (#47178)

Joshen Lim57ab28c2f000
diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
index 0b7e479e88c..95cdf11692b 100644
--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
@@ -93,8 +93,8 @@ export const CreateBranchModal = () => {
.string()
.min(1, 'Branch name cannot be empty')
.refine(
- (val) => /^[a-zA-Z0-9\-_]+$/.test(val),
- 'Branch name can only contain alphanumeric characters, hyphens, and underscores.'
+ (val) => /^[a-zA-Z0-9\-_/]+$/.test(val),
+ 'Only letters, numbers, hyphens, underscores, and forward slashes are allowed.'
)
.refine(
(val) => (branches ?? []).every((branch) => branch.name !== val),
@@ -105,7 +105,7 @@ export const CreateBranchModal = () => {
})
const form = useForm<z.infer<typeof FormSchema>>({
- mode: 'onSubmit',
+ mode: 'onChange',
reValidateMode: 'onBlur',
resolver: zodResolver(FormSchema),
defaultValues: { branchName: '', gitBranchName: '', withData: false },
@@ -307,7 +307,7 @@ export const CreateBranchModal = () => {
control={form.control}
name="branchName"
render={({ field }) => (
- <FormItemLayout label="Preview Branch Name">
+ <FormItemLayout label="Preview branch name">
<FormControl>
<Input
{...field}