From a814aac0693f6df32190ac0868c10dbf98f89620 Mon Sep 17 00:00:00 2001 From: Yasindu20 Date: Tue, 27 Jan 2026 13:18:09 +0530 Subject: [PATCH] AWS acl error fixed --- src/storage/S3StorageAdapter.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/storage/S3StorageAdapter.ts b/src/storage/S3StorageAdapter.ts index 8caaff8..20dcea6 100644 --- a/src/storage/S3StorageAdapter.ts +++ b/src/storage/S3StorageAdapter.ts @@ -9,10 +9,16 @@ export class S3StorageAdapter implements IStorageAdapter { } async save(key: string, data: Buffer): Promise { - const file: S3File = s3.file(key, { + const opts: Record = { bucket: this.bucket, - acl: "private", - }); + }; + + if (process.env.S3_USE_ACL === "true") { + const aclValue = process.env.S3_ACL_VALUE || "private"; + opts.acl = aclValue; + } + + const file: S3File = s3.file(key, opts); await file.write(data); return key;