aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/object-storage
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/object-storage')
-rw-r--r--server/lib/object-storage/shared/object-storage-helpers.ts28
1 files changed, 20 insertions, 8 deletions
diff --git a/server/lib/object-storage/shared/object-storage-helpers.ts b/server/lib/object-storage/shared/object-storage-helpers.ts
index 47c37ffda..ecb82856e 100644
--- a/server/lib/object-storage/shared/object-storage-helpers.ts
+++ b/server/lib/object-storage/shared/object-storage-helpers.ts
@@ -6,10 +6,12 @@ import {
6 CompletedPart, 6 CompletedPart,
7 CompleteMultipartUploadCommand, 7 CompleteMultipartUploadCommand,
8 CreateMultipartUploadCommand, 8 CreateMultipartUploadCommand,
9 CreateMultipartUploadCommandInput,
9 DeleteObjectCommand, 10 DeleteObjectCommand,
10 GetObjectCommand, 11 GetObjectCommand,
11 ListObjectsV2Command, 12 ListObjectsV2Command,
12 PutObjectCommand, 13 PutObjectCommand,
14 PutObjectCommandInput,
13 UploadPartCommand 15 UploadPartCommand
14} from '@aws-sdk/client-s3' 16} from '@aws-sdk/client-s3'
15import { pipelinePromise } from '@server/helpers/core-utils' 17import { pipelinePromise } from '@server/helpers/core-utils'
@@ -143,12 +145,17 @@ async function objectStoragePut (options: {
143}) { 145}) {
144 const { objectStorageKey, content, bucketInfo } = options 146 const { objectStorageKey, content, bucketInfo } = options
145 147
146 const command = new PutObjectCommand({ 148 const input: PutObjectCommandInput = {
147 Bucket: bucketInfo.BUCKET_NAME, 149 Bucket: bucketInfo.BUCKET_NAME,
148 Key: buildKey(objectStorageKey, bucketInfo), 150 Key: buildKey(objectStorageKey, bucketInfo),
149 Body: content, 151 Body: content
150 ACL: 'public-read' 152 }
151 }) 153
154 if (CONFIG.OBJECT_STORAGE.UPLOAD_ACL) {
155 input.ACL = CONFIG.OBJECT_STORAGE.UPLOAD_ACL
156 }
157
158 const command = new PutObjectCommand(input)
152 159
153 await getClient().send(command) 160 await getClient().send(command)
154 161
@@ -167,11 +174,16 @@ async function multiPartUpload (options: {
167 174
168 const statResult = await stat(inputPath) 175 const statResult = await stat(inputPath)
169 176
170 const createMultipartCommand = new CreateMultipartUploadCommand({ 177 const input: CreateMultipartUploadCommandInput = {
171 Bucket: bucketInfo.BUCKET_NAME, 178 Bucket: bucketInfo.BUCKET_NAME,
172 Key: key, 179 Key: buildKey(objectStorageKey, bucketInfo)
173 ACL: 'public-read' 180 }
174 }) 181
182 if (CONFIG.OBJECT_STORAGE.UPLOAD_ACL) {
183 input.ACL = CONFIG.OBJECT_STORAGE.UPLOAD_ACL
184 }
185
186 const createMultipartCommand = new CreateMultipartUploadCommand(input)
175 const createResponse = await s3Client.send(createMultipartCommand) 187 const createResponse = await s3Client.send(createMultipartCommand)
176 188
177 const fd = await open(inputPath, 'r') 189 const fd = await open(inputPath, 'r')