fix: Error handling on streams missing error handler on read streams.
Related https://github.com/outline/outline/discussions/5855
This commit is contained in:
@@ -115,6 +115,14 @@ export default class ZipHelper {
|
||||
currentFile: null,
|
||||
};
|
||||
|
||||
const dest = fs
|
||||
.createWriteStream(path)
|
||||
.on("finish", () => {
|
||||
Logger.debug("utils", "Writing zip complete", { path });
|
||||
return resolve(path);
|
||||
})
|
||||
.on("error", reject);
|
||||
|
||||
zip
|
||||
.generateNodeStream(
|
||||
{
|
||||
@@ -141,12 +149,11 @@ export default class ZipHelper {
|
||||
}
|
||||
}
|
||||
)
|
||||
.pipe(fs.createWriteStream(path))
|
||||
.on("finish", () => {
|
||||
Logger.debug("utils", "Writing zip complete", { path });
|
||||
return resolve(path);
|
||||
.on("error", (err) => {
|
||||
dest.end();
|
||||
reject(err);
|
||||
})
|
||||
.on("error", reject);
|
||||
.pipe(dest);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user