diff --git a/src/utils/repo-path.ts b/src/utils/repo-path.ts index 22330d275..3a6bd22be 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..594dfe176 100644 --- a/tests/repo-path.test.ts +++ b/tests/repo-path.test.ts @@ -34,6 +34,24 @@ assert.equal( 'query delimiters are rejected', ) +assert.equal( + isValidRepoPath('examples/svelte/basic/src/routes/[postId]/+page.svelte'), + true, + 'SvelteKit bracket-style dynamic route segments are valid repo path segments', +) + +assert.equal( + isValidRepoPath('examples/react/start-basic/src/routes/(auth)/login.tsx'), + true, + 'Next.js/Remix parenthesis route group segments are valid repo path segments', +) + +assert.equal( + isValidRepoPath('examples/react/start-basic/src/@components/Button.tsx'), + true, + 'at-sign path 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',