mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Bugfix/Address file name with special chars (#3496)
address file name with special chars
This commit is contained in:
@@ -140,6 +140,8 @@ const uploadFilesToAssistantVectorStore = async (req: Request, res: Response, ne
|
||||
|
||||
if (Array.isArray(files)) {
|
||||
for (const file of files) {
|
||||
// Address file name with special characters: https://github.com/expressjs/multer/issues/1104
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
||||
uploadFiles.push({
|
||||
filePath: file.path,
|
||||
fileName: file.originalname
|
||||
|
||||
@@ -81,6 +81,8 @@ const uploadAssistantFiles = async (req: Request, res: Response, next: NextFunct
|
||||
|
||||
if (Array.isArray(files)) {
|
||||
for (const file of files) {
|
||||
// Address file name with special characters: https://github.com/expressjs/multer/issues/1104
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
||||
uploadFiles.push({
|
||||
filePath: file.path,
|
||||
fileName: file.originalname
|
||||
|
||||
@@ -161,7 +161,8 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
const fileNames: string[] = []
|
||||
for (const file of files) {
|
||||
const fileBuffer = fs.readFileSync(file.path)
|
||||
|
||||
// Address file name with special characters: https://github.com/expressjs/multer/issues/1104
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
||||
const storagePath = await addArrayFilesToStorage(file.mimetype, fileBuffer, file.originalname, fileNames, chatflowid)
|
||||
|
||||
const fileInputFieldFromMimeType = mapMimeTypeToInputField(file.mimetype)
|
||||
|
||||
@@ -42,6 +42,10 @@ export const createFileAttachment = async (req: Request) => {
|
||||
for (const file of files) {
|
||||
const fileBuffer = fs.readFileSync(file.path)
|
||||
const fileNames: string[] = []
|
||||
|
||||
// Address file name with special characters: https://github.com/expressjs/multer/issues/1104
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
||||
|
||||
const storagePath = await addArrayFilesToStorage(file.mimetype, fileBuffer, file.originalname, fileNames, chatflowid, chatId)
|
||||
|
||||
const fileInputFieldFromMimeType = mapMimeTypeToInputField(file.mimetype)
|
||||
|
||||
@@ -56,7 +56,8 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
|
||||
for (const file of files) {
|
||||
const fileNames: string[] = []
|
||||
const fileBuffer = fs.readFileSync(file.path)
|
||||
|
||||
// Address file name with special characters: https://github.com/expressjs/multer/issues/1104
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
|
||||
const storagePath = await addArrayFilesToStorage(file.mimetype, fileBuffer, file.originalname, fileNames, chatflowid)
|
||||
|
||||
const fileInputFieldFromMimeType = mapMimeTypeToInputField(file.mimetype)
|
||||
|
||||
Reference in New Issue
Block a user