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:
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user