Skip to content

Commit f93eb87

Browse files
committed
fix: protect archive.finalize
1 parent d8dd408 commit f93eb87

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/streamer/route.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ router.post(
5050
downloadStream
5151
.on("error", (error) => {
5252
console.error(error);
53-
archive.finalize();
53+
try {
54+
archive.finalize();
55+
} catch (error) {}
5456
})
5557
.on("close", () => {
56-
archive.finalize();
58+
try {
59+
archive.finalize();
60+
} catch (error) {}
5761
})
5862
.pipe(Parse())
5963
.on("entry", (entry) => {
@@ -77,10 +81,14 @@ router.post(
7781
})
7882
.on("error", (error) => {
7983
console.error(error);
80-
archive.finalize();
84+
try {
85+
archive.finalize();
86+
} catch (error) {}
8187
})
8288
.on("finish", () => {
83-
archive.finalize();
89+
try {
90+
archive.finalize();
91+
} catch (error) {}
8492
});
8593
archive.pipe(res).on("error", (error) => {
8694
console.error(error);

0 commit comments

Comments
 (0)