From db2a05ee4b413efb41aaf19a36c5373a2a999e82 Mon Sep 17 00:00:00 2001 From: mediabot-pt <295750538+mediabot-pt@users.noreply.github.com> Date: Wed, 1 Jul 2026 18:18:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Qiniu=E4=B8=8B=E8=BD=BD=E6=94=B9?= =?UTF-8?q?=E7=94=A8HTTPS=E7=AD=BE=E5=90=8DURL=EF=BC=8Chttp=E2=86=92https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/par/core/storage/QiniuStorageService.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/par-core/src/main/java/com/par/core/storage/QiniuStorageService.java b/par-core/src/main/java/com/par/core/storage/QiniuStorageService.java index 718937a..5b38e0c 100644 --- a/par-core/src/main/java/com/par/core/storage/QiniuStorageService.java +++ b/par-core/src/main/java/com/par/core/storage/QiniuStorageService.java @@ -87,19 +87,14 @@ public class QiniuStorageService implements StorageService { log.warn("Qiniu stat 失败 {}: {}", path, e.response != null ? e.response.error : e.getMessage()); } - // 直接 HTTP 拉取(公开桶),不用签名 - String rawUrl = "http://" + downloadDomain + "/" + path; + // 用 HTTPS 签名 URL 拉取 + String baseUrl = "https://" + downloadDomain + "/" + path; + String signedUrl = auth.privateDownloadUrl(baseUrl, 3600); try { - var req = HttpRequest.newBuilder().uri(URI.create(rawUrl)) + var req = HttpRequest.newBuilder().uri(URI.create(signedUrl)) .timeout(Duration.ofSeconds(10)).GET().build(); var resp = httpClient.send(req, HttpResponse.BodyHandlers.ofString()); if (resp.statusCode() == 200) return resp.body(); - // 公开桶失败,尝试签名URL - String signedUrl = auth.privateDownloadUrl(rawUrl, 3600); - req = HttpRequest.newBuilder().uri(URI.create(signedUrl)) - .timeout(Duration.ofSeconds(10)).GET().build(); - resp = httpClient.send(req, HttpResponse.BodyHandlers.ofString()); - if (resp.statusCode() == 200) return resp.body(); log.warn("Qiniu 下载失败 {}: HTTP {}", path, resp.statusCode()); } catch (Exception e) { log.warn("Qiniu 下载失败 {}: {}", path, e.getMessage());