提交代码
This commit is contained in:
parent
b562b457a4
commit
4ddb442c71
|
|
@ -212,15 +212,14 @@ public class MinioUtil {
|
|||
|
||||
/**
|
||||
* 获取文件的临时访问 URL,指定过期时间
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName 存储对象名称(文件名)
|
||||
* @param expiryTimeInSeconds URL 的有效时长(秒)
|
||||
* @return 文件的临时访问 URL
|
||||
* @throws Exception 若生成 URL 过程中发生异常
|
||||
*/
|
||||
public String getFileUrl(String bucketName, String objectName, int expiryTimeInSeconds) throws Exception {
|
||||
public String getFileUrl(String objectName, int expiryTimeInSeconds) throws Exception {
|
||||
return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.bucket(minioConfig.getBucketName())
|
||||
.object(objectName)
|
||||
.expiry(expiryTimeInSeconds)
|
||||
.method(Method.GET)
|
||||
|
|
@ -229,13 +228,12 @@ public class MinioUtil {
|
|||
|
||||
/**
|
||||
* 获取文件的临时访问 URL,默认过期时间为 7 天
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName 存储对象名称(文件名)
|
||||
* @return 文件的临时访问 URL
|
||||
* @throws Exception 若生成 URL 过程中发生异常
|
||||
*/
|
||||
public String getFileUrl(String bucketName, String objectName) throws Exception {
|
||||
public String getFileUrl(String objectName) throws Exception {
|
||||
// 604800 秒 = 7 天
|
||||
return getFileUrl(bucketName, objectName, 604800);
|
||||
return getFileUrl(objectName, 604800);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue