Allow PSD uploads over 6MB
You can't currently upload PSD files over 6MB. This is because its mimetype is `image/vnd.adobe.photoshop`. We think this is an image, and non-GIF images have a limit of 6MB. To fix this, we could do one of two things: 1. Add a special case for PSD files 2. Increase the size limit for unsupported image types such as this I went with the second option. Tested this by: - adding automated tests - uploading a ~9 MB PSD file - uploading a ~1 MB PNG - uploading a ~27 MB PNG (which worked because it's converted to a smaller JPEG) - uploading a ~50 MB text file - trying to upload a ~500 MB text file (which failed, as expected) Addresses [DESKTOP-1168][]. [DESKTOP-1168]: https://signalmessenger.atlassian.net/browse/DESKTOP-1168
This commit is contained in:
parent
92e5ccd764
commit
4519aa4abf
7 changed files with 64 additions and 25 deletions
|
@ -1695,29 +1695,9 @@ Whisper.ConversationView = Whisper.View.extend({
|
|||
},
|
||||
|
||||
isSizeOkay(attachment: any) {
|
||||
let limitKb = 1000000;
|
||||
const type =
|
||||
attachment.contentType === 'image/gif'
|
||||
? 'gif'
|
||||
: attachment.contentType.split('/')[0];
|
||||
|
||||
switch (type) {
|
||||
case 'image':
|
||||
limitKb = 6000;
|
||||
break;
|
||||
case 'gif':
|
||||
limitKb = 25000;
|
||||
break;
|
||||
case 'audio':
|
||||
limitKb = 100000;
|
||||
break;
|
||||
case 'video':
|
||||
limitKb = 100000;
|
||||
break;
|
||||
default:
|
||||
limitKb = 100000;
|
||||
break;
|
||||
}
|
||||
const limitKb = window.Signal.Types.Attachment.getUploadSizeLimitKb(
|
||||
attachment.contentType
|
||||
);
|
||||
// this needs to be cast properly
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue