From edf0d4afc454efb2faaad2ddd3820b9efb4f131b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 3 Nov 2022 11:47:12 +0000 Subject: [PATCH] Fix /myroomavatar slash command (#9536) (cherry picked from commit f35d01f5df7118fb188a8b9c794aa2c03e6a7401) --- src/SlashCommands.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index 624c515b153..cce5c4ade40 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -76,7 +76,7 @@ interface HTMLInputEvent extends Event { target: HTMLInputElement & EventTarget; } -const singleMxcUpload = async (): Promise => { +const singleMxcUpload = async (): Promise => { return new Promise((resolve) => { const fileSelector = document.createElement('input'); fileSelector.setAttribute('type', 'file'); @@ -85,8 +85,13 @@ const singleMxcUpload = async (): Promise => { Modal.createDialog(UploadConfirmDialog, { file, - onFinished: (shouldContinue) => { - resolve(shouldContinue ? MatrixClientPeg.get().uploadContent(file) : null); + onFinished: async (shouldContinue) => { + if (shouldContinue) { + const { content_uri: uri } = await MatrixClientPeg.get().uploadContent(file); + resolve(uri); + } else { + resolve(null); + } }, }); };