diff --git a/sticker-creator/preload.js b/sticker-creator/preload.js index a445e41c6891..de03c8ef494a 100644 --- a/sticker-creator/preload.js +++ b/sticker-creator/preload.js @@ -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 { diff --git a/sticker-creator/store/ducks/stickers.ts b/sticker-creator/store/ducks/stickers.ts index f7041a6b83f4..1ad209c0cbd9 100644 --- a/sticker-creator/store/ducks/stickers.ts +++ b/sticker-creator/store/ducks/stickers.ts @@ -51,7 +51,7 @@ export const reset = createAction('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;