diff --git a/packages/ui/src/lib/utils/string.test.ts b/packages/ui/src/lib/utils/string.test.ts index 5cbf23f91..02b0582a9 100644 --- a/packages/ui/src/lib/utils/string.test.ts +++ b/packages/ui/src/lib/utils/string.test.ts @@ -35,6 +35,10 @@ describe.concurrent('branch slugify with valid characters', () => { test('numbers are fine', () => { expect(slugify('my/branch1')).toEqual('my/branch1'); }); + + test('underscores are fine', () => { + expect(slugify('my_branch')).toEqual('my_branch'); + }); }); describe.concurrent('branch slugify with replaced characters', () => { diff --git a/packages/ui/src/lib/utils/string.ts b/packages/ui/src/lib/utils/string.ts index b641535d3..ac34f1162 100644 --- a/packages/ui/src/lib/utils/string.ts +++ b/packages/ui/src/lib/utils/string.ts @@ -44,7 +44,7 @@ export function slugify(input: string) { .normalize('NFKD') .replace(/[\u0300-\u036f]/g, '') .trim() - .replace(/[^A-Za-z0-9/ -]/g, '') + .replace(/[^A-Za-z0-9_/ -]/g, '') .replace(/\s+/g, '-') .replace(/-+/g, '-'); }