Skip to content

Commit 249a16d

Browse files
committed
fix: use config.bucket instead of activeBucket in S3Adapter
1 parent 84aad1c commit 249a16d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/common/src/utils/storage.manager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function createS3Adapter(config) {
3636
upload: async (path, buffer, options = {}) => {
3737
try {
3838
const command = new PutObjectCommand({
39-
Bucket: activeBucket,
39+
Bucket: config.bucket,
4040
Key: path,
4141
Body: buffer,
4242
ContentType: options.contentType
@@ -51,7 +51,7 @@ function createS3Adapter(config) {
5151
try {
5252
const objects = paths.map(p => ({ Key: p }));
5353
const command = new DeleteObjectsCommand({
54-
Bucket: activeBucket,
54+
Bucket: config.bucket,
5555
Delete: { Objects: objects }
5656
});
5757
await s3Client.send(command);
@@ -68,7 +68,7 @@ function createS3Adapter(config) {
6868
actualPrefix = prefix + options.search;
6969
}
7070
const command = new ListObjectsV2Command({
71-
Bucket: activeBucket,
71+
Bucket: config.bucket,
7272
Prefix: actualPrefix,
7373
MaxKeys: options.limit || 100
7474
});
@@ -93,14 +93,14 @@ function createS3Adapter(config) {
9393
return {
9494
data: {
9595
publicUrl: null,
96-
error: `Cloudflare R2 requires a "Public URL Host" or a custom domain. Current endpoint [${config.endpoint}] for bucket [${activeBucket}] might not be publicly accessible.`
96+
error: `Cloudflare R2 requires a "Public URL Host" or a custom domain. Current endpoint [${config.endpoint}] for bucket [${config.bucket}] might not be publicly accessible.`
9797
}
9898
};
9999
}
100100
if (config.storageProvider === 'gcs') {
101-
return { data: { publicUrl: `https://storage.googleapis.com/${activeBucket}/${path}` } };
101+
return { data: { publicUrl: `https://storage.googleapis.com/${config.bucket}/${path}` } };
102102
}
103-
return { data: { publicUrl: `https://${activeBucket}.s3.${config.region}.amazonaws.com/${path}` } };
103+
return { data: { publicUrl: `https://${config.bucket}.s3.${config.region}.amazonaws.com/${path}` } };
104104
}
105105
};
106106
}

0 commit comments

Comments
 (0)