fix: Unknown mimetype should fallback to Markdown parsing if markdown extension (#1678)

closes #1675
This commit is contained in:
Tom Moor
2020-11-26 21:16:56 -08:00
committed by GitHub
parent ac349b40f5
commit 6eda1cc0d3
2 changed files with 31 additions and 2 deletions

View File

@ -94,9 +94,28 @@ describe("documentImporter", () => {
expect(response.title).toEqual("Heading 1");
});
it("should error with unknown file type", async () => {
it("should fallback to extension if mimetype unknown", async () => {
const user = await buildUser();
const name = "markdown.md";
const file = new File({
name,
type: "application/octet-stream",
path: path.resolve(__dirname, "..", "test", "fixtures", name),
});
const response = await documentImporter({
user,
file,
ip,
});
expect(response.text).toContain("This is a test paragraph");
expect(response.title).toEqual("Heading 1");
});
it("should error with unknown file type", async () => {
const user = await buildUser();
const name = "files.zip";
const file = new File({
name,
type: "executable/zip",