tencent cos 小改, 过期时间判断
This commit is contained in:
parent
8527b0233d
commit
c51ecdd680
|
|
@ -109,7 +109,7 @@ public class TencentCosConfig {
|
||||||
* 2、公共读
|
* 2、公共读
|
||||||
* 3、公共读写
|
* 3、公共读写
|
||||||
*/
|
*/
|
||||||
private Long expiryDuration = 32400L;
|
private Long expiryDuration = -1L;
|
||||||
|
|
||||||
public String getAccessKey() {
|
public String getAccessKey() {
|
||||||
return accessKey;
|
return accessKey;
|
||||||
|
|
@ -152,6 +152,10 @@ public class TencentCosConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getExpiryDuration() {
|
public Long getExpiryDuration() {
|
||||||
|
if (expiryDuration != -1 && expiryDuration < 0) {
|
||||||
|
// 最小是1秒
|
||||||
|
expiryDuration = 1L;
|
||||||
|
}
|
||||||
return expiryDuration;
|
return expiryDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,12 @@ public class TencentCosServiceImpl implements IDfsService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String presignedUrl(String fileUrl) {
|
public String presignedUrl(String fileUrl) {
|
||||||
|
if (StringUtils.isBlank(fileUrl)) {
|
||||||
|
return fileUrl;
|
||||||
|
}
|
||||||
|
if (config.getExpiryDuration() == -1) {
|
||||||
|
return fileUrl;
|
||||||
|
}
|
||||||
// 存储桶的命名格式为 BucketName-APPID,此处填写的存储桶名称必须为此格式
|
// 存储桶的命名格式为 BucketName-APPID,此处填写的存储桶名称必须为此格式
|
||||||
String bucketName = config.getBucketName();
|
String bucketName = config.getBucketName();
|
||||||
if (StringUtils.isBlank(config.getBucketName())) {
|
if (StringUtils.isBlank(config.getBucketName())) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue