don't add zero length files (also directories)
This commit is contained in:
parent
5e5af03d11
commit
8c496e3bee
1 changed files with 3 additions and 1 deletions
|
@ -53,7 +53,9 @@ export default class Archive {
|
||||||
if (this.files.length + files.length > LIMITS.MAX_FILES_PER_ARCHIVE) {
|
if (this.files.length + files.length > LIMITS.MAX_FILES_PER_ARCHIVE) {
|
||||||
throw new Error('tooManyFiles');
|
throw new Error('tooManyFiles');
|
||||||
}
|
}
|
||||||
const newFiles = files.filter(file => !isDupe(file, this.files));
|
const newFiles = files.filter(
|
||||||
|
file => file.size > 0 && !isDupe(file, this.files)
|
||||||
|
);
|
||||||
const newSize = newFiles.reduce((total, file) => total + file.size, 0);
|
const newSize = newFiles.reduce((total, file) => total + file.size, 0);
|
||||||
if (this.size + newSize > maxSize) {
|
if (this.size + newSize > maxSize) {
|
||||||
throw new Error('fileTooBig');
|
throw new Error('fileTooBig');
|
||||||
|
|
Loading…
Reference in a new issue