diff --git a/lib/server/storyHelpers/bodyHandler.ts b/lib/server/storyHelpers/bodyHandler.ts index b3e644a..4083afb 100644 --- a/lib/server/storyHelpers/bodyHandler.ts +++ b/lib/server/storyHelpers/bodyHandler.ts @@ -5,18 +5,20 @@ import mammoth from "mammoth"; import san from "sanitize-html"; import { sanitizeConf } from "../constants"; import { FormChapter } from "~/lib/client/types/form/story"; +import { log } from "../logger"; export default async function (bodyObj: FormChapter): Promise { let str: string = ""; + log.debug(JSON.stringify(bodyObj), { label: "bodyhandler" }); if (bodyObj.content) { str = bodyObj.content; } else if (bodyObj.file) { let ext = extname(bodyObj.file).toLowerCase(); - if (ext === "md" || ext === "markdown") + if (ext === ".md" || ext === ".markdown") str = marked.parse( readFileSync(resolve(`tmp/${bodyObj.file}`)).toString(), ); - else if (ext === "doc" || ext === "docx") + else if (ext === ".doc" || ext === ".docx") str = ( await mammoth.convertToHtml( { path: resolve(`tmp/${bodyObj.file}`) },