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 7c2a78c65..9c616368f 100644 --- a/tests/repo-path.test.ts +++ b/tests/repo-path.test.ts @@ -16,6 +16,12 @@ assert.equal( 'underscores remain valid repo path segments', ) +assert.equal( + isValidRepoPath('examples/svelte/ssr/src/routes/[postId]/+page.ts'), + true, + 'Svelte bracket-notation route params are valid repo path segments', +) + assert.equal( isValidRepoPath('../src/routes/__root.tsx'), false,