Fix garbled non English chars on document upload (#3301)
update handleAPIFileUpload middleware to handle non english chars + update jsdoc
This commit is contained in:
parent
dec13beb6e
commit
c36df2c364
@ -35,14 +35,15 @@ function apiDocumentEndpoints(app) {
|
||||
content: {
|
||||
"multipart/form-data": {
|
||||
schema: {
|
||||
type: 'string',
|
||||
format: 'binary',
|
||||
type: 'object',
|
||||
properties: {
|
||||
file: {
|
||||
type: 'string',
|
||||
format: 'binary',
|
||||
description: 'The file to upload'
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['file']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,14 +900,17 @@
|
||||
"content": {
|
||||
"multipart/form-data": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
"format": "binary",
|
||||
"description": "The file to upload"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,9 @@ const fileAPIUploadStorage = multer.diskStorage({
|
||||
cb(null, uploadOutput);
|
||||
},
|
||||
filename: function (_, file, cb) {
|
||||
file.originalname = normalizePath(file.originalname);
|
||||
file.originalname = normalizePath(
|
||||
Buffer.from(file.originalname, "latin1").toString("utf8")
|
||||
);
|
||||
cb(null, file.originalname);
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user