Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit da647cd

Browse files
jarnaizSyte Beimin
authored andcommitted
merge PR #100 fix relative uri encoding in S3Path
thx @sbeimin
1 parent 30dcccd commit da647cd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/java/com/upplication/s3fs/Path/ToUriTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ public void toUriWithEndSlash() {
5757
assertEquals(S3_GLOBAL_URI_TEST + "bucket/folder/", s3Path.toUri().toString());
5858
}
5959

60+
@Test
61+
public void toUriWithSpaces() {
62+
S3Path s3Path = getPath("/bucket/with spaces");
63+
64+
assertEquals(S3_GLOBAL_URI_TEST.resolve("bucket/with%20spaces") , s3Path.toUri());
65+
}
66+
6067
@Test
6168
public void toUriWithNotEndSlash() {
6269
S3Path s3Path = getPath("/bucket/file");
@@ -75,6 +82,14 @@ public void toUriRelative() {
7582
assertEquals(URI.create("with%20space"), withSpaces.toUri());
7683
}
7784

85+
@Test
86+
public void toUriRelativeWithSpaces() {
87+
S3FileSystem fileSystem = s3fsProvider.getFileSystem(S3_GLOBAL_URI_TEST);
88+
89+
S3Path path = new S3Path(fileSystem, "with space");
90+
assertEquals(URI.create("with%20space"), path.toUri());
91+
}
92+
7893
@Test
7994
public void toUriBucketWithoutEndSlash() {
8095
S3Path s3Path = getPath("/bucket");

0 commit comments

Comments
 (0)