Merge pull request #9978 from eclipse/fix/12.0.x/testcase-zipfs-backslash

Adding test to prove out zipfs bug with backslash character
This commit is contained in:
Joakim Erdfelt 2023-06-27 07:29:35 -05:00 committed by GitHub
commit 08d9535d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -318,6 +319,28 @@ public class MountedPathResourceTest
}
}
/**
* Test resolving a resource that has a backslash
*/
@Test
@Disabled("Test disabled due to a JDK bug")
public void testJarFileResourceAccessBackSlash() throws Exception
{
Path testJar = MavenTestingUtils.getTestResourcePathFile("jar-file-resource.jar");
URI uri = URI.create("jar:" + testJar.toUri().toASCIIString() + "!/");
try (ResourceFactory.Closeable resourceFactory = ResourceFactory.closeable())
{
Resource resource = resourceFactory.newResource(uri);
Resource oddities = resource.resolve("rez/oddities/");
assertThat("path /rez/oddities/ is a dir", oddities.isDirectory(), is(true));
// attempt to access a resource with a backslash
Resource someSlash = oddities.resolve("some\\slash\\you\\got\\there");
assertTrue(Resources.isReadableFile(someSlash), "someSlash is accessible as a file");
}
}
@Test
public void testJarFileResourceListDirWithSpace() throws Exception
{