mirror of
https://github.com/outline/outline.git
synced 2026-12-06 03:05:08 +03:00
fix: Do not store the attachment id map on every JSON import task (#14851)
This commit is contained in:
1 parent
f43e077389
commit
479765c808
3 files changed
+37
-12
No files matched your search
@@ -347,6 +347,31 @@ describe("JSONAPIImportTask", () => {
|
||||
expect(attachments.length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
it("rewrites document attachment references without storing the map on tasks", async () => {
|
||||
const admin = await buildAdmin();
|
||||
const { importId } = await runImport({
|
||||
teamId: admin.teamId,
|
||||
createdById: admin.id,
|
||||
zipPath: zip.filePath,
|
||||
});
|
||||
|
||||
const attachments = await Attachment.findAll({
|
||||
where: { teamId: admin.teamId },
|
||||
});
|
||||
const documents = await Document.findAll({
|
||||
where: { apiImportId: importId },
|
||||
});
|
||||
const tasks = await ImportTask.findAll({ where: { importId } });
|
||||
const content = JSON.stringify(documents.map((d) => d.content));
|
||||
|
||||
expect(
|
||||
attachments.some((a) => content.includes(Attachment.getRedirectUrl(a.id)))
|
||||
).toBe(true);
|
||||
expect(JSON.stringify(tasks.map((t) => t.input))).not.toContain(
|
||||
"attachmentIdMap"
|
||||
);
|
||||
});
|
||||
|
||||
it("deletes the source archive after the import completes", async () => {
|
||||
const admin = await buildAdmin();
|
||||
const sourceAttachment = await buildAttachment({
|
||||
|
||||
Reference in new issue
Block a user