diff --git a/lib/aboutPages.ts b/lib/aboutPages.ts index 6448c663..b8dc4c84 100644 --- a/lib/aboutPages.ts +++ b/lib/aboutPages.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import fs from "fs"; import path from "path"; @@ -7,12 +8,15 @@ import { processMarkdownAsHTML } from "@/utils/remarkUtils"; const contentDirectory = path.join(process.cwd(), "app/[locale]/about/[slug]"); export async function checkIfSlugIsValid(slug: string) { + console.info("checking slug", slug); if (!slug || typeof slug !== "string") { + console.error("slug is not a string", slug); return false; } // Check that the slug does not contain any slashes to prevent directory traversal if (slug.includes("/") || slug.includes("\\")) { + console.error("slug contains slashes", slug); return false; } @@ -21,7 +25,8 @@ export async function checkIfSlugIsValid(slug: string) { try { await fs.promises.access(fullPath); return true; - } catch { + } catch (e) { + console.error("slug error", slug); return false; } }