feat: additionally sanitize slugs
Some checks failed
/ deploy (push) Failing after 40s

This commit is contained in:
Dariusz Niemczyk 2025-02-15 01:17:49 +01:00
parent 4bc8882620
commit 9fc91d9480
No known key found for this signature in database

View file

@ -9,7 +9,12 @@ export default async function Page({
const { slug, locale } = await params
const currentLocale = getLocale(locale)
console.log(slug, locale)
const isReallyProperSlug = /^[a-zA-Z0-9_-]+$/.test(slug)
if (!isReallyProperSlug) {
notFound()
}
try {
const path = `@/pages/${currentLocale}/${slug}.mdx`
const pagemodule = await import(path)