Skip to content

s3x - Coversion from URI to Path and Then Back to URI Loses the Initial Configuration #237

Closed
@thsandu

Description

I have issues working with conversions from URI to Path and back when using the s3x and the cool endpoint overriding functionality. It seems to me that when we are using the toUri() on a path, the initial overridden configuration is lost.

I forked your repo to add a unit test.

As you can see here, the s3 case is working: https://github.com/thsandu/aws-java-nio-spi-for-s3-issues-with-s3x/blob/b22de4a8dd68745191d797225c78c035ad30abf1/src/test/java/software/amazon/nio/spi/s3/S3PathTest.java#L365

When I so something similar on the s3x case, I get a modified result: https://github.com/thsandu/aws-java-nio-spi-for-s3-issues-with-s3x/blob/b22de4a8dd68745191d797225c78c035ad30abf1/src/test/java/software/amazon/nio/spi/s3x/S3PathTest.java#L51

        URI uri = URI.create("s3x://somewhere.com:1010/bucket/subfolder/afile.txt");
        Path path = Paths.get(uri);

        Path convertedPath = Paths.get(path.toUri());

        then(convertedPath).isEqualTo(path);

The test yields:

expected: /subfolder/afile.txt
 but was: /afile.txt

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions