Skip to content

Commit 8a328bc

Browse files
committed
fix: filename encoding adjustment
1 parent 15b3160 commit 8a328bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/whatsapp/routers/chat.router.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export function ChatRouter(chatController: ChatController, ...guards: RequestHan
213213
.setHeader('Content-type', response.mimetype)
214214
.setHeader(
215215
'Content-Disposition',
216-
'inline; filename="' + response.fileName + '"',
216+
'inline; filename="' + encodeURIComponent(response.fileName) + '"',
217217
);
218218

219219
const transform: Transform = response.stream;
@@ -231,7 +231,7 @@ export function ChatRouter(chatController: ChatController, ...guards: RequestHan
231231
const form = new FormData();
232232

233233
form.append('mediaType', response.mediaType);
234-
form.append('fileName', response.fileName);
234+
form.append('fileName', encodeURIComponent(response.fileName));
235235
form.append('size', JSON.stringify(response.size));
236236
form.append('mimetype', response.mimetype);
237237

@@ -240,7 +240,7 @@ export function ChatRouter(chatController: ChatController, ...guards: RequestHan
240240
}
241241

242242
form.append('file', response.stream, {
243-
filename: response.filename,
243+
filename: encodeURIComponent(response.fileName),
244244
contentType: response.mimetype,
245245
});
246246

0 commit comments

Comments
 (0)