Merge pull request #695 from shikhar-scs/warning-for-high-file-size

Show Warning, Cancel and Redirect on size > 2GB ; fixes #578
This commit is contained in:
Danny Coates 2018-01-08 20:11:44 -08:00 committed by GitHub
commit 4f1ccf83c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules
dist
.idea

View file

@ -1,7 +1,8 @@
/* global MAXFILESIZE */
const html = require('choo/html');
const assets = require('../../common/assets');
const fileList = require('./fileList');
const { fadeOut } = require('../utils');
const { bytes, fadeOut } = require('../utils');
module.exports = function(state, emit) {
const div = html`
@ -64,6 +65,11 @@ module.exports = function(state, emit) {
if (file.size === 0) {
return;
}
if (file.size > MAXFILESIZE) {
window.alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) }));
return;
}
await fadeOut('page-one');
emit('upload', { file, type: 'click' });
}