From b461c8cc99dd46f4d76efb48626bbea8ac223661 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 01 九月 2021 15:38:08 +0800 Subject: [PATCH] update spring-boot-admin 2.5.0 => 2.5.1 update aliyun.oss 3.13.0 => 3.13.1 update qcloud.cos 5.6.47 => 5.6.51 update hutool 5.7.9 => 5.7.11 update maven-jar-plugin 3.1.1 => 3.2.0 --- ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioCloudStorageStrategy.java | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioCloudStorageStrategy.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioCloudStorageStrategy.java index 9edb421..3bbf187 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioCloudStorageStrategy.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioCloudStorageStrategy.java @@ -20,9 +20,10 @@ */ public class MinioCloudStorageStrategy extends AbstractCloudStorageStrategy { - private final MinioClient minioClient; + private MinioClient minioClient; - public MinioCloudStorageStrategy(CloudStorageProperties cloudStorageProperties) { + @Override + public void init(CloudStorageProperties cloudStorageProperties) { properties = cloudStorageProperties; try { minioClient = MinioClient.builder() @@ -31,7 +32,7 @@ .build(); createBucket(); } catch (Exception e) { - throw new IllegalArgumentException("Minio瀛樺偍閰嶇疆閿欒! 璇锋鏌ョ郴缁熼厤缃�!"); + throw new OssException("Minio瀛樺偍閰嶇疆閿欒! 璇锋鏌ョ郴缁熼厤缃�:[" + e.getMessage() + "]"); } } @@ -50,7 +51,7 @@ .config(getPolicy(bucketName, PolicyType.READ)) .build()); } catch (Exception e) { - throw new OssException("鍒涘缓Bucket澶辫触, 璇锋牳瀵筂inio閰嶇疆淇℃伅"); + throw new OssException("鍒涘缓Bucket澶辫触, 璇锋牳瀵筂inio閰嶇疆淇℃伅:[" + e.getMessage() + "]"); } } @@ -74,7 +75,7 @@ .stream(inputStream, inputStream.available(), -1) .build()); } catch (Exception e) { - throw new OssException("涓婁紶鏂囦欢澶辫触锛岃鏍稿Minio閰嶇疆淇℃伅"); + throw new OssException("涓婁紶鏂囦欢澶辫触锛岃鏍稿Minio閰嶇疆淇℃伅:[" + e.getMessage() + "]"); } return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); } @@ -94,12 +95,12 @@ @Override public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) { - return upload(data, getPath("", suffix), contentType); + return upload(data, getPath(properties.getPrefix(), suffix), contentType); } @Override public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) { - return upload(inputStream, getPath("", suffix), contentType); + return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType); } @Override -- Gitblit v1.9.3