fix(file-manager): when the endpoint is not empty, forcePathStyle is set to true (#5712)

This commit is contained in:
chenos 2024-11-22 20:29:33 +08:00 committed by GitHub
parent 06b23bb176
commit e7e7c6dc00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,9 @@ export default class extends StorageType {
const { S3Client } = require('@aws-sdk/client-s3'); const { S3Client } = require('@aws-sdk/client-s3');
const multerS3 = require('multer-s3'); const multerS3 = require('multer-s3');
const { accessKeyId, secretAccessKey, bucket, acl = 'public-read', ...options } = storage.options; const { accessKeyId, secretAccessKey, bucket, acl = 'public-read', ...options } = storage.options;
if (options.endpoint) {
options.forcePathStyle = true;
}
const s3 = new S3Client({ const s3 = new S3Client({
...options, ...options,
credentials: { credentials: {