From 422760040c62a66c727d04181959921f345b7ccf Mon Sep 17 00:00:00 2001 From: jackieZhouQQ <108133430+jackieZhouQQ@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:20:03 +0800 Subject: [PATCH] =?UTF-8?q?minio=20=E4=BD=BF=E7=94=A8=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E6=97=B6=EF=BC=8CforcePathStyle=E4=B8=BAtrue=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BA=A7=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=98=AF=20xx.com/bucket=E7=9A=84=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/interface.ts | 2 ++ file/src/file.ts | 4 +++- file/src/interface.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/interface.ts b/core/src/interface.ts index 12b997d..0a6d10f 100644 --- a/core/src/interface.ts +++ b/core/src/interface.ts @@ -220,6 +220,8 @@ export interface AWSConfig { expires?: number /** publicDomain */ publicDomain?: string; + /** forcePathStyle */ + forcePathStyle?: boolean; } /** diff --git a/file/src/file.ts b/file/src/file.ts index b855011..2911d4f 100644 --- a/file/src/file.ts +++ b/file/src/file.ts @@ -78,7 +78,7 @@ export class CoolFile { this.client = new QINIU.auth.digest.Mac(accessKeyId, accessKeySecret); } if (aws) { - const { accessKeyId, secretAccessKey, region, publicDomain } = aws; + const { accessKeyId, secretAccessKey, region, publicDomain, forcePathStyle } = aws; this.client = new S3Client({ region, credentials: { accessKeyId, secretAccessKey }, @@ -86,6 +86,8 @@ export class CoolFile { endpoint: publicDomain ? publicDomain : `https://s3.${region}.amazonaws.com`, + // minio 使用域名时,forcePathStyle为true时,不增加二级域名,而是 xx.com/bucket的形式 + forcePathStyle: forcePathStyle ? forcePathStyle : false, }); } } diff --git a/file/src/interface.ts b/file/src/interface.ts index 52ff144..70e8178 100644 --- a/file/src/interface.ts +++ b/file/src/interface.ts @@ -108,6 +108,8 @@ export interface AWSConfig { expires?: number; /** publicDomain */ publicDomain?: string; + /** forcePathStyle */ + forcePathStyle?: boolean; } export interface QINIUConfig {