From bf693ab9798157291f4ce9eb93f6c2c797e01c03 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 5 Sep 2024 00:53:08 +0200 Subject: [PATCH] Show error if attachment is rejected for having invalid mime type --- src/components/compose.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/compose.jsx b/src/components/compose.jsx index d74fc4e5..c0743512 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -584,7 +584,15 @@ function Compose({ const item = items[i]; if (item.kind === 'file') { const file = item.getAsFile(); - if (file && supportedMimeTypes.includes(file.type)) { + if (!file) { + alert(`Could not access the given attachment.`); + return; + } + else if (!supportedMimeTypes.includes(file.type)) { + alert(`Your instance does not allow attachments of type "${file.type}".`); + return; + } + else { files.push(file); } }