From 412ec8ae146fa85b65d8a2719ca62069e5f7f86d Mon Sep 17 00:00:00 2001 From: Looly Date: Fri, 10 May 2024 17:35:52 +0800 Subject: [PATCH] =?UTF-8?q?HttpRequest#get=E4=B8=8D=E5=86=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95File=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/hutool/core/net/url/UrlBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hutool-core/src/main/java/org/dromara/hutool/core/net/url/UrlBuilder.java b/hutool-core/src/main/java/org/dromara/hutool/core/net/url/UrlBuilder.java index 8f4df31bc..fabd8da0f 100644 --- a/hutool-core/src/main/java/org/dromara/hutool/core/net/url/UrlBuilder.java +++ b/hutool-core/src/main/java/org/dromara/hutool/core/net/url/UrlBuilder.java @@ -138,11 +138,12 @@ public final class UrlBuilder implements Builder { httpUrl = "http://" + httpUrl; } - return of(httpUrl, charset); + return of(UrlUtil.toUrlForHttp(httpUrl), charset); } /** - * 使用URL字符串构建UrlBuilder,默认使用UTF-8编码 + * 使用URL字符串构建UrlBuilder,默认使用UTF-8编码
+ * 注意:此方法如果提供的URL为非网络协议,自动尝试使用文件协议 * * @param url URL字符串 * @return UrlBuilder