Skip to content

Commit 5f8a238

Browse files
authored
fix: Prevent trailing slash in example paths
1 parent 50bf8c0 commit 5f8a238

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/routes/_library/$libraryId/$version.docs.framework.$framework.examples.$.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const Route = createFileRoute(
133133
throw notFound()
134134
}
135135

136-
const examplePath = [framework, params._splat].join('/')
136+
const examplePath = [framework, params._splat].filter(Boolean).join('/')
137137
const defaultStartingPath = getExampleStartingPath(
138138
framework,
139139
params.libraryId,
@@ -349,7 +349,7 @@ function ExternalExamplePage({
349349
throw notFound()
350350
}
351351

352-
const examplePath = [frameworkId, _splat].join('/')
352+
const examplePath = [frameworkId, _splat].filter(Boolean).join('/')
353353

354354
const mainExampleFile = getExampleStartingPath(frameworkId, libraryId)
355355

@@ -610,7 +610,7 @@ function ClientExamplePage({
610610
const { version, framework, _splat, libraryId } = Route.useParams()
611611
const library = getLibrary(libraryId)
612612
const branch = getBranch(library, version)
613-
const examplePath = [framework, _splat].join('/')
613+
const examplePath = [framework, _splat].filter(Boolean).join('/')
614614
const githubUrl = `https://github.com/${library.repo}/tree/${branch}/examples/${examplePath}`
615615
const initialFile = (
616616
definition.initialFile ?? definition.workspace.entry

0 commit comments

Comments
 (0)