Skip to content

Commit

Permalink
Handle BlobPath's trailing separator case (#23091)
Browse files Browse the repository at this point in the history
  • Loading branch information
mms-programming authored and tlrx committed Feb 22, 2017
1 parent 148be11 commit d31e415
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public BlobPath add(String path) {

public String buildAsString() {
String p = String.join(SEPARATOR, paths);
if (p.isEmpty()) {
if (p.isEmpty() || p.endsWith(SEPARATOR)) {
return p;
}
return p + SEPARATOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ public void testBuildAsString() {
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/"));
}
}

0 comments on commit d31e415

Please sign in to comment.