Skip to content

Commit

Permalink
Issue #104: Routes without trailing slash lead to 404
Browse files Browse the repository at this point in the history
Signed-off-by: macdonst <[email protected]>
  • Loading branch information
macdonst committed Dec 12, 2022
1 parent 1e802c0 commit 08bbe90
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/api/docs/$$.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable filenames/match-regex */
import { readFileSync } from 'fs'
import { existsSync, readFileSync } from 'fs'
import { URL } from 'url'
import { Arcdown } from 'arcdown'
import arcStaticImg from 'markdown-it-arc-static-img'
Expand Down Expand Up @@ -34,7 +34,10 @@ export async function get(request) {
const gacode =
process.env.ARC_ENV === 'production' ? 'G-FQHNPN78V3' : 'G-0ES194BJQ6'

const docURL = new URL(`../../docs/md/${docPath}.md`, import.meta.url)
let docURL = new URL(`../../docs/md/${docPath}.md`, import.meta.url)
if (!existsSync(docURL.pathname)) {
docURL = new URL(`../../docs/md/${docPath}/index.md`, import.meta.url)
}

const sidebarData = navDataLoader('docs', activePath)

Expand Down

0 comments on commit 08bbe90

Please sign in to comment.