Skip to content

Commit dd3154e

Browse files
fix
1 parent 6394b01 commit dd3154e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pages/api/social-image.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
getBlockIcon,
77
getBlockTitle,
88
getPageProperty,
9-
isUrl
9+
isUrl,
10+
parsePageId
1011
} from 'notion-utils'
1112

1213
import * as libConfig from '@/lib/config'
@@ -23,7 +24,9 @@ export default async function OGImage(
2324
res: NextApiResponse
2425
) {
2526
const { searchParams } = new URL(req.url)
26-
const pageId = searchParams.get('id') || libConfig.rootNotionPageId
27+
const pageId = parsePageId(
28+
searchParams.get('id') || libConfig.rootNotionPageId
29+
)
2730
if (!pageId) {
2831
return new Response('Invalid notion page id', { status: 400 })
2932
}

0 commit comments

Comments
 (0)