From 306651902896904ae1600febb02137e2ca127a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 22 May 2023 12:02:34 -0400 Subject: [PATCH] add await --- src/posts/uploads.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/posts/uploads.js b/src/posts/uploads.js index 27a6c10168..1c23071c5d 100644 --- a/src/posts/uploads.js +++ b/src/posts/uploads.js @@ -124,10 +124,9 @@ module.exports = function (Posts) { })); orphans = orphans.filter(Boolean); - // Note: no await. Deletion not guaranteed by method end. - orphans.forEach((relPath) => { - file.delete(_getFullPath(relPath)); - }); + await Promise.all(orphans.map(async (relPath) => { + await file.delete(_getFullPath(relPath)); + })); return orphans; };