From 816e1fbf9ba8eababd78a48786078fee9e0e4e44 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 18 Aug 2025 08:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E3=80=91BOOT=20?= =?UTF-8?q?=E5=92=8C=20CLOUD=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/core/client/s3/S3FileClient.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-server/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java b/yudao-module-infra/yudao-module-infra-server/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java index 8e21c76f4..8e7f74611 100644 --- a/yudao-module-infra/yudao-module-infra-server/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java +++ b/yudao-module-infra/yudao-module-infra-server/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java @@ -105,8 +105,8 @@ public class S3FileClient extends AbstractFileClient { @Override public String presignPutUrl(String path) { return presigner.presignPutObject(PutObjectPresignRequest.builder() - .signatureDuration(EXPIRATION_DEFAULT) - .putObjectRequest(b -> b.bucket(config.getBucket()).key(path)).build()) + .signatureDuration(EXPIRATION_DEFAULT) + .putObjectRequest(b -> b.bucket(config.getBucket()).key(path)).build()) .url().toString(); } @@ -126,15 +126,10 @@ public class S3FileClient extends AbstractFileClient { String finalPath = path; Duration expiration = expirationSeconds != null ? Duration.ofSeconds(expirationSeconds) : EXPIRATION_DEFAULT; URL signedUrl = presigner.presignGetObject(GetObjectPresignRequest.builder() - .signatureDuration(expiration) - .getObjectRequest(b -> b.bucket(config.getBucket()).key(finalPath)).build()) + .signatureDuration(expiration) + .getObjectRequest(b -> b.bucket(config.getBucket()).key(finalPath)).build()) .url(); - // 特殊:适配未使用 domain 返回的情况!!! - String signedUrlStr = signedUrl.toString(); - if (!signedUrlStr.startsWith(config.getDomain())) { - signedUrlStr = signedUrlStr.replaceFirst(signedUrl.getProtocol() + "://" + signedUrl.getHost(), config.getDomain()); - } - return signedUrlStr; + return signedUrl.toString(); } /**