mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-03-01 10:24:40 +08:00
fixed exception with invalid buffer length
This commit is contained in:
parent
64ccb33ee5
commit
df1b73083a
1 changed files with 4 additions and 2 deletions
|
@ -63,8 +63,10 @@ class LengthLimiter extends Transform {
|
|||
_flush(done) {
|
||||
if (!this.finished) {
|
||||
// add padding if incoming stream stopped too early
|
||||
let buf = Buffer.from(this.padding.repeat(this.expectedLength - this.byteCounter));
|
||||
this.push(buf);
|
||||
if (this.expectedLength > this.byteCounter) {
|
||||
let buf = Buffer.from(this.padding.repeat(this.expectedLength - this.byteCounter));
|
||||
this.push(buf);
|
||||
}
|
||||
this.finished = true;
|
||||
}
|
||||
done();
|
||||
|
|
Loading…
Reference in a new issue