enforce maxUploadSize

pull/1/head
ansuz 7 years ago
parent fc8847dae4
commit 02dbe9e458

@ -571,7 +571,9 @@ define(function () {
out.upload_uploadPending = "You already have an upload in progress. Cancel it and upload your new file?";
out.upload_success = "Your file ({0}) has been successfully uploaded and added to your drive.";
out.upload_notEnoughSpace = "There is not enough space for this file in your CryptDrive.";
out.upload_notEnoughSpaceBrief = "Not enough space";
out.upload_tooLarge = "This file exceeds the maximum upload size.";
out.upload_tooLargeBrief = 'File too large';
out.upload_choose = "Choose a file";
out.upload_pending = "Pending";
out.upload_cancelled = "Cancelled";

@ -935,6 +935,7 @@ var upload_status = function (Env, publicKey, filesize, cb) {
if (typeof(filesize) !== 'number' &&
filesize >= 0) { return void cb('E_INVALID_SIZE'); }
if (filesize >= Env.maxUploadSize) { return cb('TOO_LARGE'); }
// validate that the provided path is not junk
var filePath = makeFilePath(paths.staging, publicKey);
if (!filePath) { return void cb('E_INVALID_PATH'); }

@ -131,11 +131,11 @@ define([
queue.inProgress = false;
queue.next();
if (e === 'TOO_LARGE') {
// TODO update table to say too big?
$pv.text(Messages.upload_tooLargeBrief);
return void UI.alert(Messages.upload_tooLarge);
}
if (e === 'NOT_ENOUGH_SPACE') {
// TODO update table to say not enough space?
$pv.text(Messages.upload_notEnoughSpaceBrief);
return void UI.alert(Messages.upload_notEnoughSpace);
}
console.error(e);

Loading…
Cancel
Save