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: surprising behavior of the normalize method - turns a path from absolute to relative #292

Closed
thsandu opened this issue Nov 9, 2023 · 0 comments

Comments

@thsandu
Copy link

thsandu commented Nov 9, 2023

I noticed that normalizing an absolute S3Path results in the path not being absolute anymore. Is this a conscious deviation from other implementations?

Here a small test showing the behavior for Windows and Jimfs:

@Test
public void normalizedAbsolute() {
	assertTrue(Paths.get("C:\\foo\\.\\bar").normalize().isAbsolute());
	assertFalse(Paths.get("foo\\.\\bar").normalize().isAbsolute());

	FileSystem linux = Jimfs.newFileSystem("testme", Configuration.unix());
	assertTrue(linux.getPath("/foo/./bar").normalize().isAbsolute());
	assertFalse(linux.getPath("foo/./bar").normalize().isAbsolute());
}

I added here a unit test in my fork to show the issue: https://github.com/thsandu/aws-java-nio-spi-for-s3-issues-with-s3x/blob/378feb0251bc0010bbc9112a9c3c7d6c2166508d/src/test/java/software/amazon/nio/spi/s3/S3PathTest.java#L280

stefanofornari pushed a commit to stefanofornari/aws-java-nio-spi-for-s3 that referenced this issue Mar 16, 2024
stefanofornari pushed a commit to stefanofornari/aws-java-nio-spi-for-s3 that referenced this issue May 20, 2024
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

1 participant