check that the size of an encrypted upload will be within the upload limit before encrypting

pull/1/head
ansuz 4 years ago
parent 3be0b439bd
commit 0152321992

@ -129,8 +129,8 @@ define([
var l = privateData.plan ? ApiConfig.premiumUploadSize : false; var l = privateData.plan ? ApiConfig.premiumUploadSize : false;
l = l || ApiConfig.maxUploadSize || "?"; l = l || ApiConfig.maxUploadSize || "?";
var maxSizeStr = Util.bytesToMegabytes(l); var maxSizeStr = Util.bytesToMegabytes(l);
// XXX blob.byteLength is wrong: we should use the lenght of the encrypted content (see whiteboard) var estimate = FileCrypto.computeEncryptedSize((blob && blob.byteLength) || 0, metadata);
if (blob && blob.byteLength && typeof(l) === "number" && blob.byteLength > l) { if (blob && blob.byteLength && typeof(estimate) === 'number' && typeof(l) === "number" && estimate > l) {
$pv.text(Messages.error); $pv.text(Messages.error);
queue.inProgress = false; queue.inProgress = false;
queue.next(); queue.next();

Loading…
Cancel
Save