Поправлен неверный вызов reject
This commit is contained in:
@@ -171,7 +171,7 @@ class FileDecompressor {
|
|||||||
|
|
||||||
if (this.limitFileSize) {
|
if (this.limitFileSize) {
|
||||||
if ((await fs.stat(filename)).size > this.limitFileSize) {
|
if ((await fs.stat(filename)).size > this.limitFileSize) {
|
||||||
reject('Файл слишком большой');
|
reject(new Error('Файл слишком большой'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class LimitedQueue {
|
|||||||
get(onPlaceChange) {
|
get(onPlaceChange) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (this.destroyed)
|
if (this.destroyed)
|
||||||
reject('destroyed');
|
reject(new Error('destroyed'));
|
||||||
|
|
||||||
const take = () => {
|
const take = () => {
|
||||||
if (this.freed <= 0)
|
if (this.freed <= 0)
|
||||||
@@ -73,7 +73,7 @@ class LimitedQueue {
|
|||||||
if (onPlaceChange)
|
if (onPlaceChange)
|
||||||
onPlaceChange(this.listeners.length);
|
onPlaceChange(this.listeners.length);
|
||||||
} else {
|
} else {
|
||||||
reject('Превышен размер очереди ожидания');
|
reject(new Error('Превышен размер очереди ожидания'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,13 +76,13 @@ class ZipStreamer {
|
|||||||
if (limitFileCount || limitFileSize || decodeEntryNameCallback) {
|
if (limitFileCount || limitFileSize || decodeEntryNameCallback) {
|
||||||
const entries = Object.values(unzip.entries());
|
const entries = Object.values(unzip.entries());
|
||||||
if (limitFileCount && entries.length > limitFileCount) {
|
if (limitFileCount && entries.length > limitFileCount) {
|
||||||
reject('Слишком много файлов');
|
reject(new Error('Слишком много файлов'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (limitFileSize && !entry.isDirectory && entry.size > limitFileSize) {
|
if (limitFileSize && !entry.isDirectory && entry.size > limitFileSize) {
|
||||||
reject('Файл слишком большой');
|
reject(new Error('Файл слишком большой'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user