UriComponentsBuilder parse of empty fragments
Check for an empty fragment in UriComponentsBuilder.fromUriString(...) to prevent the invocation of fragment(...). Previously, UriComponentsBuilder.fromUriString(...) threw an exception in the case of an empty fragment being provided (e.g. /example#). Issue: SPR-10363
This commit is contained in:
committed by
Phillip Webb
parent
8e4e0f3531
commit
3eb3610660
@@ -48,6 +48,7 @@ import org.springframework.web.util.HierarchicalUriComponents.PathComponent;
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Phillip Webb
|
||||
* @author Oliver Gierke
|
||||
* @since 3.1
|
||||
* @see #newInstance()
|
||||
* @see #fromPath(String)
|
||||
@@ -204,7 +205,10 @@ public class UriComponentsBuilder {
|
||||
builder.path(path);
|
||||
builder.query(query);
|
||||
}
|
||||
builder.fragment(fragment);
|
||||
|
||||
if (StringUtils.hasText(fragment)) {
|
||||
builder.fragment(fragment);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user