|
@@ -11,6 +11,7 @@ import io.minio.http.Method;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
@@ -55,12 +56,12 @@ public class MinioServiceImpl implements FileService {
|
|
|
@Override
|
|
|
public String getDownloadUrl(String object, int duration, TimeUnit unit) {
|
|
|
try {
|
|
|
- return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
|
|
+ return StringUtils.delete(minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
|
|
.expiry(duration, unit)
|
|
|
.bucket(minioConfig.getBucket())
|
|
|
.object(object)
|
|
|
.method(Method.GET)
|
|
|
- .build());
|
|
|
+ .build()), minioConfig.getEndpoint());
|
|
|
} catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidKeyException |
|
|
|
InvalidResponseException | IOException | NoSuchAlgorithmException | XmlParserException |
|
|
|
ServerException e) {
|
|
@@ -101,10 +102,12 @@ public class MinioServiceImpl implements FileService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取对象存储服务的地址
|
|
|
+ * 获取存储桶名称
|
|
|
+ *
|
|
|
+ * @return {@link String}
|
|
|
*/
|
|
|
@Override
|
|
|
- public String getEndpointBucket() {
|
|
|
- return minioConfig.getEndpoint() + minioConfig.getBucket();
|
|
|
+ public String getBucket() {
|
|
|
+ return minioConfig.getBucket();
|
|
|
}
|
|
|
}
|