From 6b1f4203dc07f580a5a75c6abafbdc3485e86437 Mon Sep 17 00:00:00 2001 From: Nagy Viktor Date: Wed, 14 Feb 2024 21:39:10 +0100 Subject: [PATCH] fix: encoding filename in Content-Disposition header --- packages/sn-client-core/src/Repository/Upload.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sn-client-core/src/Repository/Upload.ts b/packages/sn-client-core/src/Repository/Upload.ts index c8a7cc06d..4ff1e7bad 100644 --- a/packages/sn-client-core/src/Repository/Upload.ts +++ b/packages/sn-client-core/src/Repository/Upload.ts @@ -174,7 +174,7 @@ export class Upload { method: 'POST', headers: { 'Content-Range': `bytes 0-${this.repository.configuration.chunkSize - 1}/${options.file.size}`, - 'Content-Disposition': `attachment; filename="${options.file.name}"`, + 'Content-Disposition': `attachment; filename="${encodeURIComponent(options.file.name)}"`, }, }) @@ -200,7 +200,7 @@ export class Upload { method: 'POST', headers: { 'Content-Range': `bytes ${start}-${end - 1}/${options.file.size}`, - 'Content-Disposition': `attachment; filename="${options.file.name}"`, + 'Content-Disposition': `attachment; filename="${encodeURIComponent(options.file.name)}"`, }, }) if (lastResponse.ok) {