Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3Path::toUri does not preserve trailing slash #76

Closed
osialr opened this issue May 2, 2017 · 1 comment
Closed

S3Path::toUri does not preserve trailing slash #76

osialr opened this issue May 2, 2017 · 1 comment

Comments

@osialr
Copy link

osialr commented May 2, 2017

An S3Path that points to a directory does not preserve the trailing slash when calling S3Path::toUri. For example instead of s3://s3.amazonaws.com/bucket/foo/, the method returns s3://s3.amazonaws.com/bucket/foo

This can be see in the modified unit test:

    @Test
    public void createWithPathAndTrailingSlash() {
        S3Path path = forPath("/bucket/path/to/file/");

        assertEquals("bucket", path.getFileStore().name());
        assertEquals("path/to/file", path.getKey());
        assertEquals(S3EndpointConstant.S3_GLOBAL_URI_TEST.resolve("/bucket/path/to/file/"), 
                     path.toUri());
    }

Fails with

java.lang.AssertionError: 
Expected :s3://s3.test.amazonaws.com/bucket/path/to/file/
Actual   :s3://s3.test.amazonaws.com/bucket/path/to/file
jarnaiz added a commit that referenced this issue Nov 27, 2017
2.0.0
----
Changelog:
* Preserve URI with end slash #76
* Removed META-INF/services/java.nio.file.spi.FileTypeDetector #78
* Bucket are filestores and root directories for a bucket is the bucket itself.
* getFileName for a root Path is ```null```
* Improved S3Path Tests
@jarnaiz
Copy link
Member

jarnaiz commented Nov 27, 2017

Solved in version 2.0.0

Thanks for the feedback!

adamstruck pushed a commit to adamstruck/Amazon-S3-FileSystem-NIO2 that referenced this issue Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants