Fix max size for animated stickers (#4625)
This commit is contained in:
parent
0626a94288
commit
4bb8ed0a3e
2 changed files with 8 additions and 1 deletions
|
@ -15,6 +15,7 @@ const { nativeTheme } = remote.require('electron');
|
|||
const STICKER_SIZE = 512;
|
||||
const MIN_STICKER_DIMENSION = 10;
|
||||
const MAX_STICKER_DIMENSION = STICKER_SIZE;
|
||||
const MAX_WEBP_STICKER_BYTE_LENGTH = 100 * 1024;
|
||||
const MAX_ANIMATED_STICKER_BYTE_LENGTH = 300 * 1024;
|
||||
|
||||
window.ROOT_PATH = window.location.href.startsWith('file') ? '../../' : '/';
|
||||
|
@ -128,6 +129,12 @@ window.processStickerImage = async path => {
|
|||
})
|
||||
.webp()
|
||||
.toBuffer();
|
||||
if (processedBuffer.byteLength > MAX_WEBP_STICKER_BYTE_LENGTH) {
|
||||
throw processStickerError(
|
||||
'Sticker file was too large',
|
||||
'StickerCreator--Toasts--tooLarge'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -51,7 +51,7 @@ export const reset = createAction<void>('stickers/reset');
|
|||
|
||||
export const minStickers = 1;
|
||||
export const maxStickers = 200;
|
||||
export const maxByteSize = 100 * 1024;
|
||||
export const maxByteSize = 300 * 1024;
|
||||
|
||||
interface StateStickerData {
|
||||
readonly imageData?: StickerImageData;
|
||||
|
|
Loading…
Reference in a new issue