@nger/fk-upload 1.0.68 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,12 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
21
21
|
constructor() {
|
22
22
|
super(actions_1.DOWNLOAD_ACTION);
|
23
23
|
}
|
24
|
+
downloadingCount = 0;
|
24
25
|
async handle(injector, next) {
|
26
|
+
if (this.downloadingCount > 3) {
|
27
|
+
throw new Error(`system is busy`);
|
28
|
+
}
|
29
|
+
this.downloadingCount += 1;
|
25
30
|
const db = injector.get(typeorm_1.Db);
|
26
31
|
const task = injector.get(rabbitmq_1.DATA);
|
27
32
|
const complete = injector.get(rabbitmq_1.COMPLETE);
|
@@ -66,6 +71,11 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
66
71
|
req.on('response', async (resp) => {
|
67
72
|
const headers = resp.headers;
|
68
73
|
total = Number(headers["content-length"]);
|
74
|
+
if (total > 1024 * 1024 * 1024) {
|
75
|
+
console.log(`file is to large`);
|
76
|
+
req.destroy();
|
77
|
+
complete();
|
78
|
+
}
|
69
79
|
});
|
70
80
|
if (next)
|
71
81
|
await next();
|
@@ -20,6 +20,10 @@ class EffectTask extends rabbitmq_1.Task {
|
|
20
20
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 3 });
|
21
21
|
if (task.topicId) {
|
22
22
|
await (0, fs_extra_1.unlink)(task.path);
|
23
|
+
if (task.uploadUrl.startsWith('https://site')) {
|
24
|
+
complete();
|
25
|
+
return;
|
26
|
+
}
|
23
27
|
await w7.manager.update(w7_1.W7ChatTopicEntity, task.topicId, { thirdUrl: task.uploadUrl }).then(() => complete()).catch(() => fail());
|
24
28
|
complete();
|
25
29
|
}
|