fix: Download as Markdown should use .md extension

closes #5113
This commit is contained in:
Tom Moor
2023-03-29 07:43:40 -04:00
parent f86ae64a69
commit 980e613a7b

View File

@@ -530,12 +530,17 @@ router.post(
}
if (contentType !== "application/json") {
// Override the extension for Markdown as it's incorrect in the mime-types
// library until a new release > 2.1.35
const extension =
contentType === "text/markdown" ? "md" : mime.extension(contentType);
ctx.set("Content-Type", contentType);
ctx.set(
"Content-Disposition",
`attachment; filename="${slugify(
document.titleWithDefault
)}.${mime.extension(contentType)}"`
)}.${extension}"`
);
ctx.body = content;
return;