From 9be58ba0b4b92e0291ada5a01ee42f67be1d3611 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Thu, 1 Jun 2023 21:30:23 +0200 Subject: [PATCH] missing inversion + use proper emoji path --- .../queue/processors/db/import-custom-emojis.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/queue/processors/db/import-custom-emojis.ts b/packages/backend/src/queue/processors/db/import-custom-emojis.ts index 7dbb525d3..a40f2c5cb 100644 --- a/packages/backend/src/queue/processors/db/import-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/import-custom-emojis.ts @@ -96,19 +96,16 @@ export async function importCustomEmojis( let containedEmojis = fs.readdirSync(outputPath); - // Filter directories - containedEmojis = containedEmojis.filter( - (emoji) => !fs.lstatSync(`${outputPath}/${emoji}`).isDirectory(), - ); - // Filter out accidental JSON files containedEmojis = containedEmojis.filter((emoji) => - emoji.match(/\.(json)$/i), + !emoji.match(/\.(json)$/i), ); - for (const emojiPath of containedEmojis) { + for (const emojiFilename of containedEmojis) { // strip extension and get filename to use as name - const name = path.basename(emojiPath, path.extname(emojiPath)); + const name = path.basename(emojiFilename, path.extname(emojiFilename)); + const emojiPath = `${outputPath}/${emojiFilename}`; + logger.info(`importing ${name}`) await Emojis.delete({ @@ -117,7 +114,7 @@ export async function importCustomEmojis( const driveFile = await addFile({ user: null, path: emojiPath, - name: path.basename(emojiPath), + name: path.basename(emojiFilename), force: true, }); const file = fs.createReadStream(emojiPath);