diff --git a/server/utils/zip.js b/server/utils/zip.js index f4cbfe03..3b11d2ae 100644 --- a/server/utils/zip.js +++ b/server/utils/zip.js @@ -34,7 +34,11 @@ async function archiveToPath(zip) { export async function archiveCollection(collection: Collection) { const zip = new JSZip(); - await addToArchive(zip, collection.documentStructure); + + if (collection.documentStructure) { + await addToArchive(zip, collection.documentStructure); + } + return archiveToPath(zip); } @@ -42,8 +46,10 @@ export async function archiveCollections(collections: Collection[]) { const zip = new JSZip(); for (const collection of collections) { - const folder = zip.folder(collection.name); - await addToArchive(folder, collection.documentStructure); + if (collection.documentStructure) { + const folder = zip.folder(collection.name); + await addToArchive(folder, collection.documentStructure); + } } return archiveToPath(zip); }