Accept any file if supportedMediaTypes is undefined

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

View file

@ -222,7 +222,7 @@ function Compose({
charactersReservedPerUrl, charactersReservedPerUrl,
} = {}, } = {},
mediaAttachments: { mediaAttachments: {
supportedMimeTypes = [], supportedMimeTypes,
imageSizeLimit, imageSizeLimit,
imageMatrixLimit, imageMatrixLimit,
videoSizeLimit, videoSizeLimit,
@ -588,7 +588,7 @@ function Compose({
alert(`Could not access the given attachment.`); alert(`Could not access the given attachment.`);
return; return;
} }
else if (!supportedMimeTypes.includes(file.type)) { else if (supportedMimeTypes !== undefined && !supportedMimeTypes.includes(file.type)) {
alert(`Your instance does not allow attachments of type "${file.type}".`); alert(`Your instance does not allow attachments of type "${file.type}".`);
return; return;
} }
@ -1262,7 +1262,7 @@ function Compose({
<label class="toolbar-button"> <label class="toolbar-button">
<input <input
type="file" type="file"
accept={supportedMimeTypes.join(',')} accept={supportedMimeTypes?.join(',')}
multiple={mediaAttachments.length < maxMediaAttachments - 1} multiple={mediaAttachments.length < maxMediaAttachments - 1}
disabled={ disabled={
uiState === 'loading' || uiState === 'loading' ||