Show error if attachment is rejected for having invalid mime type

This commit is contained in:
Stefano Pigozzi 2024-09-05 00:53:08 +02:00
parent 5d6a43e5d2
commit bf693ab979
No known key found for this signature in database
GPG key ID: 5ADA3868646C3FC0

View file

@ -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);
}
}