From 935aa24f9fbcdf334add245dd65f521ef42930d7 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Apr 2021 14:52:06 +0200 Subject: [PATCH] Fix whiteboard embed size limit --- www/whiteboard/inner.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index ac32f5dbd..13a0fa82f 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -373,8 +373,9 @@ define([ APP.FM.handleFile(blob); }); }; - var MAX_IMAGE_SIZE = 1 * 1024 * 1024; // 1 MB - var maxSizeStr = Util.bytesToMegabytes(MAX_IMAGE_SIZE); + var ONE_MB = 1 * 1024 * 1024; // 1 MB + var MAX_IMAGE_SIZE = Math.ceil(ONE_MB / 3) * 4 + 23; // 23 is the length of "data:image/jpeg;base64," + var maxSizeStr = Util.bytesToMegabytes(ONE_MB); var addImageToCanvas = function (img) { if (img.src && img.src.length > MAX_IMAGE_SIZE) { UI.warn(Messages._getKey('upload_tooLargeBrief', [maxSizeStr]));