mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
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() {
|
public String buildAsString() {
|
||||||
String p = String.join(SEPARATOR, paths);
|
String p = String.join(SEPARATOR, paths);
|
||||||
if (p.isEmpty()) {
|
if (p.isEmpty() || p.endsWith(SEPARATOR)) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return p + SEPARATOR;
|
return p + SEPARATOR;
|
||||||
|
@ -35,5 +35,7 @@ public class BlobPathTests extends ESTestCase {
|
|||||||
path = path.add("b").add("c");
|
path = path.add("b").add("c");
|
||||||
assertThat(path.buildAsString(), is("a/b/c/"));
|
assertThat(path.buildAsString(), is("a/b/c/"));
|
||||||
|
|
||||||
|
path = path.add("d/");
|
||||||
|
assertThat(path.buildAsString(), is("a/b/c/d/"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user