don't add zero length files (also directories)
This commit is contained in:
parent
5e5af03d11
commit
8c496e3bee
|
@ -53,7 +53,9 @@ export default class Archive {
|
|||
if (this.files.length + files.length > LIMITS.MAX_FILES_PER_ARCHIVE) {
|
||||
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);
|
||||
if (this.size + newSize > maxSize) {
|
||||
throw new Error('fileTooBig');
|
||||
|
|
Loading…
Reference in New Issue