Handle BlobPath's trailing separator case (#23091)
This commit is contained in:
parent
148be11f26
commit
d31e41547a
|
@ -63,7 +63,7 @@ public class BlobPath implements Iterable<String> {
|
|||
|
||||
public String buildAsString() {
|
||||
String p = String.join(SEPARATOR, paths);
|
||||
if (p.isEmpty()) {
|
||||
if (p.isEmpty() || p.endsWith(SEPARATOR)) {
|
||||
return p;
|
||||
}
|
||||
return p + SEPARATOR;
|
||||
|
|
|
@ -35,5 +35,7 @@ public class BlobPathTests extends ESTestCase {
|
|||
path = path.add("b").add("c");
|
||||
assertThat(path.buildAsString(), is("a/b/c/"));
|
||||
|
||||
path = path.add("d/");
|
||||
assertThat(path.buildAsString(), is("a/b/c/d/"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue