Skip to content

Commit 33fa931

Browse files
arunodankzawa
authored andcommitted
Resolve the path in renderJSON before serving. (#599)
1 parent 81a6758 commit 33fa931

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/render.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import fs from 'mz/fs'
55
import send from 'send'
66
import accepts from 'accepts'
77
import requireModule from './require'
8+
import resolvePath from './resolve'
89
import readPage from './read-page'
910
import { Router } from '../lib/router'
1011
import Head, { defaultHead } from '../lib/head'
@@ -97,7 +98,7 @@ async function doRender (req, res, pathname, query, {
9798
}
9899

99100
export async function renderJSON (req, res, page, { dir = process.cwd() } = {}) {
100-
const pagePath = join(dir, '.next', 'bundles', 'pages', `${page}.json`)
101+
const pagePath = await resolvePath(join(dir, '.next', 'bundles', 'pages', page))
101102
return serveStaticWithGzip(req, res, pagePath)
102103
}
103104

0 commit comments

Comments
 (0)