mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
refactor: use fileSize limiternative to multer (#1209)
This commit is contained in:
parent
5e6f8cbce7
commit
55cdd2eec6
1 changed files with 1 additions and 5 deletions
|
|
@ -29,13 +29,9 @@ const fileFilter = (req, file, cb) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.size > sizeLimit) {
|
|
||||||
return cb(new Error(`File size exceeds ${sizeLimit / 1024 / 1024} MB.`), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cb(null, true);
|
cb(null, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const upload = multer({ storage, fileFilter });
|
const upload = multer({ storage, fileFilter, limits: { fileSize: sizeLimit } });
|
||||||
|
|
||||||
module.exports = upload;
|
module.exports = upload;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue