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

Commit 1873592

Browse files
committed
Merge branch 'sbeimin-#99'
2 parents a024ac7 + 901163d commit 1873592

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.upplication</groupId>
55
<artifactId>s3fs</artifactId>
66
<packaging>jar</packaging>
7-
<version>2.2.1</version>
7+
<version>2.2.2</version>
88
<name>s3fs</name>
99
<description>S3 filesystem provider for Java 7</description>
1010
<url>https://github.com/Upplication/Amazon-S3-FileSystem-NIO2</url>

src/main/java/com/upplication/s3fs/S3Path.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public URI toUri() {
465465
return URI.create("s3://" + normalizeURI(builder.toString()));
466466
}
467467
else {
468-
return URI.create(this.uri);
468+
return URI.create(uri);
469469
}
470470
}
471471

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");
@@ -72,6 +79,14 @@ public void toUriRelative() {
7279
assertEquals(URI.create("bla"), path.toUri());
7380
}
7481

82+
@Test
83+
public void toUriRelativeWithSpaces() {
84+
S3FileSystem fileSystem = s3fsProvider.getFileSystem(S3_GLOBAL_URI_TEST);
85+
86+
S3Path path = new S3Path(fileSystem, "with space");
87+
assertEquals(URI.create("with%20space"), path.toUri());
88+
}
89+
7590
@Test
7691
public void toUriBucketWithoutEndSlash() {
7792
S3Path s3Path = getPath("/bucket");

0 commit comments

Comments
 (0)