Normalize 2+ '/' in path in UriComponentsBuilder

Issue: SPR-12398
This commit is contained in:
Rossen Stoyanchev
2014-10-30 14:49:20 -04:00
parent e9f53c6ddf
commit d8941ca098
2 changed files with 16 additions and 1 deletions

View File

@@ -720,7 +720,14 @@ public class UriComponentsBuilder {
if (this.path.length() == 0) {
return null;
}
String path = this.path.toString().replace("//", "/");
String path = this.path.toString();
while (true) {
int index = path.indexOf("//");
if (index == -1) {
break;
}
path = path.substring(0, index) + path.substring(index + 1);
}
return new HierarchicalUriComponents.FullPathComponent(path);
}