fix: Long collection description prevents import (#3847)

* fix: Long collection description prevents import
fix: Parallelize attachment upload during import

* fix: Improve Notion image import matching

* chore: Bump JSZIP (perf)

* fix: Allow redirect from /doc/<id> to canonical url

* fix: Importing document with only title duplicates title in body
This commit is contained in:
Tom Moor
2022-07-24 09:37:20 +01:00
committed by GitHub
parent 4f537c7578
commit 7ae892fe06
9 changed files with 70 additions and 31 deletions

View File

@@ -148,6 +148,21 @@ describe("documentImporter", () => {
expect(response.title).toEqual("Heading 1");
});
it("should handle only title", async () => {
const user = await buildUser();
const fileName = "markdown.md";
const content = `# Title`;
const response = await documentImporter({
user,
mimeType: "text/plain",
fileName,
content,
ip,
});
expect(response.text).toEqual("");
expect(response.title).toEqual("Title");
});
it("should fallback to extension if mimetype unknown", async () => {
const user = await buildUser();
const fileName = "markdown.md";

View File

@@ -190,7 +190,7 @@ async function documentImporter({
if (text.startsWith("# ")) {
const result = parseTitle(text);
title = result.title;
text = text.replace(`# ${title}\n`, "");
text = text.replace(`# ${title}`, "").trimStart();
}
// If we parsed an emoji from _above_ the title then add it back at prefixing