diff --git a/server/endpoints/api/document/index.js b/server/endpoints/api/document/index.js index f07d18685ebee92e4e8ccef29eafc16fe1847b51..60090bddcbd9ce48e3cd9bd8c0b084e81131955a 100644 --- a/server/endpoints/api/document/index.js +++ b/server/endpoints/api/document/index.js @@ -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'] } } } diff --git a/server/swagger/openapi.json b/server/swagger/openapi.json index dd45fe34b3abdb322c35380d1106ece23004ac8c..91d0aa53db41d1cc63628e893a98f13657c3a57e 100644 --- a/server/swagger/openapi.json +++ b/server/swagger/openapi.json @@ -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" + ] } } } diff --git a/server/utils/files/multer.js b/server/utils/files/multer.js index 18c6df6079c704c374752162a82fbcf64a22feb0..ee0de4b1159f3741535102458737fe3613d9b488 100644 --- a/server/utils/files/multer.js +++ b/server/utils/files/multer.js @@ -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); }, });