diff --git a/src/utils/repo-path.ts b/src/utils/repo-path.ts index 22330d275..f7b790c6c 100644 --- a/src/utils/repo-path.ts +++ b/src/utils/repo-path.ts @@ -1,6 +1,6 @@ export const MAX_REPO_PATH_LENGTH = 512 -const REPO_PATH_SEGMENT_PATTERN = /^[a-zA-Z0-9._$+-]+$/ +const REPO_PATH_SEGMENT_PATTERN = /^[a-zA-Z0-9._$+\[\]-]+$/ export function isValidRepoPath(path: string) { if (path === '') { diff --git a/tests/repo-path.test.ts b/tests/repo-path.test.ts index b990d1ebc..95b0ee17a 100644 --- a/tests/repo-path.test.ts +++ b/tests/repo-path.test.ts @@ -34,6 +34,12 @@ assert.equal( 'query delimiters are rejected', ) +assert.equal( + isValidRepoPath('examples/svelte/ssr/src/routes/[postId]/+page.svelte'), + true, + 'SvelteKit/Next.js dynamic route bracket segments are valid repo path segments', +) + assert.equal( joinRepoPath('examples/react/start-basic', 'src/routes/__root.tsx'), 'examples/react/start-basic/src/routes/__root.tsx',