!898 修复Gitee issue #I66CIR

Merge pull request !898 from Tom Xin/v5-dev-fix_#I66CIR
This commit is contained in:
Looly 2022-12-27 11:37:11 +00:00 committed by Gitee
commit 7ee9b163c4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -108,9 +108,7 @@ public final class UrlBuilder implements Builder<String> {
*/ */
public static UrlBuilder ofHttp(String httpUrl, Charset charset) { public static UrlBuilder ofHttp(String httpUrl, Charset charset) {
Assert.notBlank(httpUrl, "Http url must be not blank!"); Assert.notBlank(httpUrl, "Http url must be not blank!");
if (!httpUrl.startsWith("http://")&&!httpUrl.startsWith("https://")) {
final int sepIndex = httpUrl.indexOf("://");
if (sepIndex < 0) {
httpUrl = "http://" + httpUrl.trim(); httpUrl = "http://" + httpUrl.trim();
} }
return of(httpUrl, charset); return of(httpUrl, charset);