show 404 for draft pages

This commit is contained in:
EGOIST 2022-05-20 17:37:57 +08:00
parent d7c27cf582
commit c5dc1d2d19
1 changed files with 1 additions and 1 deletions

View File

@ -286,7 +286,7 @@ export async function getPage<TRender extends boolean = false>(
}
if (!gate.allows({ type: "can-read-page", page })) {
if (page.publishedAt > new Date()) {
if (!page.published || page.publishedAt > new Date()) {
throw notFound()
} else {
throw gate.permissionError()