mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🐞 fix: Handle Garbled Chinese Characters in File Upload (#2261)
Co-authored-by: 彭修照 <pengxiuzhao.uh@haier.com>
This commit is contained in:
parent
4854b39f41
commit
cc92597f14
2 changed files with 2 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ const storage = multer.diskStorage({
|
|||
},
|
||||
filename: function (req, file, cb) {
|
||||
req.file_id = crypto.randomUUID();
|
||||
file.originalname = decodeURIComponent(file.originalname);
|
||||
cb(null, `${file.originalname}`);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ const useFileHandling = (params?: UseFileHandling) => {
|
|||
startUploadTimer(extendedFile.file_id, extendedFile.file?.name || 'File');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', extendedFile.file as File);
|
||||
formData.append('file', extendedFile.file as File, encodeURIComponent(extendedFile.file?.name || 'File'));
|
||||
formData.append('file_id', extendedFile.file_id);
|
||||
if (extendedFile.width) {
|
||||
formData.append('width', extendedFile.width?.toString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue