mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-08 07:00:54 +03:00
don't add zero length files (also directories)
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user