|
@@ -1,12 +1,15 @@
|
|
|
package cn.tr.plugin.file.config.minio;
|
|
package cn.tr.plugin.file.config.minio;
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.tr.core.utils.MediaTypeUtils;
|
|
import cn.tr.core.utils.MediaTypeUtils;
|
|
|
import cn.tr.plugin.file.config.AbstractFileClient;
|
|
import cn.tr.plugin.file.config.AbstractFileClient;
|
|
|
import cn.tr.plugin.file.config.FileContent;
|
|
import cn.tr.plugin.file.config.FileContent;
|
|
|
import io.minio.*;
|
|
import io.minio.*;
|
|
|
import io.minio.http.Method;
|
|
import io.minio.http.Method;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+
|
|
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -96,10 +99,10 @@ public class MinIoFileClient extends AbstractFileClient<MinIoFileClientConfig> {
|
|
|
|
|
|
|
|
private String getPresignedObjectUrl(String bizPath) throws Exception {
|
|
private String getPresignedObjectUrl(String bizPath) throws Exception {
|
|
|
bizPath=parseBizPath(bizPath);
|
|
bizPath=parseBizPath(bizPath);
|
|
|
- return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
|
|
|
|
- .bucket(getConfig().getMinioBucketName())
|
|
|
|
|
- .method(Method.GET)
|
|
|
|
|
- .object(bizPath)
|
|
|
|
|
- .build());
|
|
|
|
|
|
|
+ String httpUrl = getConfig().getMinioHttpUrl();
|
|
|
|
|
+ if(!StrUtil.endWith(httpUrl,"/")){
|
|
|
|
|
+ httpUrl=httpUrl+"/";
|
|
|
|
|
+ }
|
|
|
|
|
+ return httpUrl+getConfig().getMinioBucketName()+"/"+bizPath;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|