Skip to content

Commit 61e6adc

Browse files
committed
Fixes #256
1 parent 5a4721f commit 61e6adc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/processMultipart.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,12 @@ module.exports = (options, req, res, next) => {
5858
? tempFileHandler(options, field, filename) // Upload into temporary file.
5959
: memHandler(options, field, filename); // Upload into RAM.
6060

61-
const writePromise = getWritePromise();
62-
if (options.useTempFiles) {
63-
writePromise.catch(err => {
61+
const writePromise = options.useTempFiles
62+
? getWritePromise().catch(err => {
6463
uploadTimer.clear();
6564
cleanup();
6665
next(err);
67-
});
68-
}
66+
}) : getWritePromise();
6967

7068
// Define upload timer.
7169
const uploadTimer = new UploadTimer(options.uploadTimeout, () => {
@@ -152,10 +150,6 @@ module.exports = (options, req, res, next) => {
152150
.then(() => {
153151
delete req[waitFlushProperty];
154152
next();
155-
}).catch(err => {
156-
delete req[waitFlushProperty];
157-
debugLog(options, `Error while waiting files flush: ${err}`);
158-
next(err);
159153
});
160154
});
161155

0 commit comments

Comments
 (0)