From b64c3a57919a39b16ea71b32c5a474fbba0aa28f Mon Sep 17 00:00:00 2001 From: N-Pex Date: Wed, 24 Mar 2021 16:44:29 +0100 Subject: [PATCH] Fix image uploading on Nang Issue #82. Turns out we need to send mime "application/octet-stream" for encrypted image data. It's a little unclear why it worked for audio though. --- src/plugins/utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/utils.js b/src/plugins/utils.js index e7c4cae..b27463b 100644 --- a/src/plugins/utils.js +++ b/src/plugins/utils.js @@ -314,8 +314,14 @@ class Util { messageContent.file = encryptedFile; + // Encrypted data sent as octet-stream! + opts.type = "application/octet-stream"; + matrixClient.uploadContent(data, opts) .then((response) => { + if (response.error) { + return reject(response.error); + } encryptedFile.url = response.content_uri; return this.sendMessage(matrixClient, roomId, "m.room.message", messageContent) })