fix: 腾讯 COS 异常,Region 必传
This commit is contained in:
parent
6f8384af70
commit
2fea3a8e83
@ -9,10 +9,11 @@ import io.minio.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_ALIYUN;
|
||||
import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_TENCENT;
|
||||
|
||||
/**
|
||||
* 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务
|
||||
*
|
||||
* <p>
|
||||
* S3 协议的客户端,采用亚马逊提供的 software.amazon.awssdk.s3 库
|
||||
*
|
||||
* @author 芋道源码
|
||||
@ -78,6 +79,11 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
||||
.replaceAll("-internal", "")// 去除内网 Endpoint 的后缀
|
||||
.replaceAll("https://", "");
|
||||
}
|
||||
// 腾讯云必须有 region,否则会报错
|
||||
if (config.getEndpoint().contains(ENDPOINT_TENCENT)) {
|
||||
return StrUtil.subAfter(config.getEndpoint(), ".cos.", false)
|
||||
.replaceAll("." + ENDPOINT_TENCENT, ""); // 去除 Endpoint
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ public class S3FileClientConfig implements FileClientConfig {
|
||||
|
||||
public static final String ENDPOINT_QINIU = "qiniucs.com";
|
||||
public static final String ENDPOINT_ALIYUN = "aliyuncs.com";
|
||||
public static final String ENDPOINT_TENCENT = "myqcloud.com";
|
||||
|
||||
/**
|
||||
* 节点地址
|
||||
|
Loading…
Reference in New Issue
Block a user