don't add zero length files (also directories)

This commit is contained in:
Danny Coates 2019-01-03 16:12:40 -08:00
parent 5e5af03d11
commit 8c496e3bee
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB

View file

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