From 6f92d8c2f73b482ebf0f5197c7442a0376182b49 Mon Sep 17 00:00:00 2001 From: Naty S Date: Tue, 30 Dec 2025 13:38:02 +0800 Subject: [PATCH] feat(store-s3): add optional ACL option for uploads (disabled by default) --- packages/store-s3/index.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/store-s3/index.js b/packages/store-s3/index.js index fcf932a7d..ccc863d93 100644 --- a/packages/store-s3/index.js +++ b/packages/store-s3/index.js @@ -28,6 +28,7 @@ export default class S3Store { * @param {string} [options.region] - Region name * @param {string} [options.endpoint] - Endpoint URL * @param {string} [options.bucket] - Bucket name + * @param {string} [options.acl] - Access Control List (ACL) policy */ constructor(options = {}) { this.options = { ...defaults, ...options }; @@ -115,11 +116,17 @@ export default class S3Store { * @returns {Promise} File created */ async createFile(filePath, content) { - const putCommand = new PutObjectCommand({ - Bucket: this.options.bucket, - Key: filePath, - Body: content, - }); + const params = { + Bucket: this.options.bucket, + Key: filePath, + Body: content, + }; + + if (this.options.acl) { + params.ACL = this.options.acl; + } + + const putCommand = new PutObjectCommand(params); try { const fileExists = await this.fileExists(filePath); @@ -181,11 +188,15 @@ export default class S3Store { * @returns {Promise} Updated file URL */ async updateFile(filePath, content, options) { - const putCommand = new PutObjectCommand({ + const params = { Bucket: this.options.bucket, Key: filePath, Body: content, - }); + }; + if (this.options.acl) { + params.ACL = this.options.acl; + } + const putCommand = new PutObjectCommand(params); try { const { ETag } = await this.client().send(putCommand);