From 91153e1ad4228cc5e3c548ace39afca8794c8195 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 8 Nov 2024 10:48:01 +0100 Subject: [PATCH] fix: fix the internal server error with "'" in blog post slugs --- app/(root)/blog/[slug]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(root)/blog/[slug]/page.tsx b/app/(root)/blog/[slug]/page.tsx index c5680dc..891e63b 100644 --- a/app/(root)/blog/[slug]/page.tsx +++ b/app/(root)/blog/[slug]/page.tsx @@ -26,7 +26,7 @@ import { Button } from "@/components/ui/button"; async function getData(slug: string) { const query = ` - *[_type == "blog" && slug.current == '${slug}'] { + *[_type == "blog" && slug.current == '${slug.replace(/\'/g, "\\'")}'] { "currentSlug": slug.current, title, content,