Support for server-configurable maximum attachment size

This commit is contained in:
Scott Nonnenberg 2022-04-13 10:47:39 -07:00 committed by GitHub
parent 677548f3a3
commit 37c44fb631
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 38 deletions

View file

@ -8,6 +8,7 @@ import type {
AttachmentDraftType,
InMemoryAttachmentDraftType,
} from '../types/Attachment';
import { getMaximumAttachmentSize } from '../types/Attachment';
import { AttachmentToastType } from '../types/AttachmentToastType';
import { fileToBytes } from './fileToBytes';
import { handleImageAttachment } from './handleImageAttachment';
@ -44,8 +45,7 @@ export function preProcessAttachment(
return;
}
const MB = 1000 * 1024;
if (file.size > 100 * MB) {
if (file.size > getMaximumAttachmentSize()) {
return AttachmentToastType.ToastFileSize;
}