This commit is contained in:
Travis Fischer
2024-11-07 18:49:04 -06:00
parent 6394b01ed0
commit dd3154eff2

View File

@@ -6,7 +6,8 @@ import {
getBlockIcon,
getBlockTitle,
getPageProperty,
isUrl
isUrl,
parsePageId
} from 'notion-utils'
import * as libConfig from '@/lib/config'
@@ -23,7 +24,9 @@ export default async function OGImage(
res: NextApiResponse
) {
const { searchParams } = new URL(req.url)
const pageId = searchParams.get('id') || libConfig.rootNotionPageId
const pageId = parsePageId(
searchParams.get('id') || libConfig.rootNotionPageId
)
if (!pageId) {
return new Response('Invalid notion page id', { status: 400 })
}