From 07a70111ce45abb56543f99f0cad1c761ec35088 Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Mon, 12 Apr 2021 17:32:18 +0800 Subject: [PATCH] Fix: retrieve folders with collection.yml only --- routes/folders.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/routes/folders.js b/routes/folders.js index faabdc769..a1c33aee3 100644 --- a/routes/folders.js +++ b/routes/folders.js @@ -21,10 +21,16 @@ async function listAllFolderContent (req, res, next) { const IsomerCollection = new Collection(accessToken, siteName) const allFolders = IsomerCollection.list() - const allFolderContent = await Bluebird.map(allFolders, async (collectionName) => { - const config = new CollectionConfig(accessToken, siteName, collectionName) - const { sha, content } = await config.read() - return { name: collectionName, sha, content } + const allFolderContent = [] + + await Bluebird.map(allFolders, async (collectionName) => { + try { + const config = new CollectionConfig(accessToken, siteName, collectionName) + const { sha, content } = await config.read() + allFolderContent.push({ name: collectionName, sha, content }) + } catch (err) { + console.log(err) + } }) res.status(200).json({ allFolderContent })