From 953cabfce52158ecbd149bc02409c2ebb4c7695f Mon Sep 17 00:00:00 2001 From: Adrien Boutigny Date: Wed, 10 Jan 2024 11:15:58 +0100 Subject: [PATCH] encode CopySource prop when copying S3 files --- confiture-rest-api/src/audits/file-storage.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confiture-rest-api/src/audits/file-storage.service.ts b/confiture-rest-api/src/audits/file-storage.service.ts index 11acaa38..a555ab06 100644 --- a/confiture-rest-api/src/audits/file-storage.service.ts +++ b/confiture-rest-api/src/audits/file-storage.service.ts @@ -67,9 +67,9 @@ export class FileStorageService { (d) => new CopyObjectCommand({ Bucket: this.config.get("S3_BUCKET"), - CopySource: `/${this.config.get("S3_BUCKET")}/${ - d.originalKey - }`, + CopySource: encodeURIComponent( + `/${this.config.get("S3_BUCKET")}/${d.originalKey}` + ), Key: d.destinationKey, ACL: "public-read" })