From 1e75b81a5e2aec37c6a5bf773245f55bdb4c01b6 Mon Sep 17 00:00:00 2001 From: Nils <7890309+DarkView@users.noreply.github.com> Date: Thu, 19 Aug 2021 17:25:19 +0200 Subject: [PATCH] Post: fix `cannot read pipe` error when no file is present on message (#249) --- backend/src/plugins/Post/util/postMessage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Post/util/postMessage.ts b/backend/src/plugins/Post/util/postMessage.ts index 9d4b67f4..5bb13095 100644 --- a/backend/src/plugins/Post/util/postMessage.ts +++ b/backend/src/plugins/Post/util/postMessage.ts @@ -30,6 +30,7 @@ export async function postMessage( name: attachments[0].name, file: await fsp.readFile(downloadedAttachment.path), }; + content.files = [file.file]; } if (enableMentions) { @@ -38,7 +39,7 @@ export async function postMessage( }; } - const createdMsg = await channel.send({ ...content, files: [file] }); + const createdMsg = await channel.send(content); pluginData.state.savedMessages.setPermanent(createdMsg.id); if (downloadedAttachment) {