enforce maxUploadSize

This commit is contained in:
ansuz 2018-01-18 12:19:58 +01:00
parent fc8847dae4
commit 02dbe9e458
3 changed files with 5 additions and 2 deletions

View file

@ -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";

1
rpc.js
View file

@ -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'); }

View file

@ -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);