Browse Source

Limit scheme/host check in fromUriString to HTTP URLs

Closes gh-26258
pull/1283/head
Rossen Stoyanchev 4 years ago
parent
commit
f07fc76cf3
  1. 4
      spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

4
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

@ -252,8 +252,8 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable { @@ -252,8 +252,8 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
builder.schemeSpecificPart(ssp);
}
else {
if (StringUtils.hasLength(scheme) && !StringUtils.hasLength(host)) {
throw new IllegalArgumentException("[" + uri + "] is not a valid URI");
if (StringUtils.hasLength(scheme) && scheme.startsWith("http") && !StringUtils.hasLength(host)) {
throw new IllegalArgumentException("[" + uri + "] is not a valid HTTP URL");
}
builder.userInfo(userInfo);
builder.host(host);

Loading…
Cancel
Save