From a7bf467675e82becb207f5a3759cb8affb56d3fd Mon Sep 17 00:00:00 2001 From: wangya <757914144@qq.com> Date: Wed, 18 Aug 2021 13:49:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3minIO=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8A=E4=BC=A0=E5=88=B0https=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20fix:=20minIO=E7=9A=84Region=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E9=9D=9E=E5=BF=85=E8=A6=81=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/run/halo/app/handler/file/MinioFileHandler.java | 6 ++++-- .../java/run/halo/app/model/properties/MinioProperties.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/run/halo/app/handler/file/MinioFileHandler.java b/src/main/java/run/halo/app/handler/file/MinioFileHandler.java index 43483d8a7f..389f9b92ac 100644 --- a/src/main/java/run/halo/app/handler/file/MinioFileHandler.java +++ b/src/main/java/run/halo/app/handler/file/MinioFileHandler.java @@ -51,7 +51,7 @@ public UploadResult upload(@NonNull MultipartFile file) { String source = optionService.getByPropertyOrDefault(MinioProperties.SOURCE, String.class, ""); String region = - optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString(); + optionService.getByPropertyOrDefault(MinioProperties.REGION, String.class, "us-east-1"); endpoint = StringUtils.appendIfMissing(endpoint, HaloConst.URL_SEPARATOR); @@ -78,6 +78,7 @@ public UploadResult upload(@NonNull MultipartFile file) { .stream(file.getInputStream(), file.getSize(), -1) .object(upFilePath) .build(); + minioClient.ignoreCertCheck(); minioClient.putObject(putObjectArgs); UploadResult uploadResult = new UploadResult(); @@ -114,7 +115,7 @@ public void delete(@NonNull String key) { String bucketName = optionService.getByPropertyOfNonNull(MinioProperties.BUCKET_NAME).toString(); String region = - optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString(); + optionService.getByPropertyOrDefault(MinioProperties.REGION, String.class, "us-east-1"); MinioClient minioClient = MinioClient.builder() .endpoint(endPoint) @@ -123,6 +124,7 @@ public void delete(@NonNull String key) { .build(); try { + minioClient.ignoreCertCheck(); minioClient.removeObject(RemoveObjectArgs.builder() .bucket(bucketName) .object(key) diff --git a/src/main/java/run/halo/app/model/properties/MinioProperties.java b/src/main/java/run/halo/app/model/properties/MinioProperties.java index ec6c4e6b37..6af0365943 100644 --- a/src/main/java/run/halo/app/model/properties/MinioProperties.java +++ b/src/main/java/run/halo/app/model/properties/MinioProperties.java @@ -36,7 +36,7 @@ public enum MinioProperties implements PropertyEnum { /** * Minio regoin */ - REGION("minio_region", String.class, ""); + REGION("minio_region", String.class, "us-east-1"); private final String value;