jetty.project
jetty.project copied to clipboard
Jetty 12 : Rework `PathResource.checkAliasPath` to handle `jar:file:` paths more elegantly
Reworked the PathResource.checkAliasPath ...
If the URI is a jar:file: based, the URI only check is skipped and the path segment checks still apply.
Also, the symlink check is skipped (as it's not possible to have symlinks in zipfs)
I need more test cases!
What is a combination of ..
- A zipfs PathResource
- A request path used in
resolve(String)that resolves to a resource that exists, but can be viewed as an alias.
@joakime Can you look at the disabled test org.eclipse.jetty.ee10.servlet.DefaultServletTest#testListingFilenamesOnlyUrlResource in relation to the changes in this PR.
Is using jar:file URIs and in 12.0.x was failing because it was being classified as an alias because of trailing slash. But now on this PR the test it is throwing UnsupportedOperationException.
java.lang.UnsupportedOperationException
at jdk.zipfs/jdk.nio.zipfs.ZipPath.toFile(ZipPath.java:669)
at org.eclipse.jetty.server/org.eclipse.jetty.server.ResourceListing.getAsHTML(ResourceListing.java:207)
at org.eclipse.jetty.server/org.eclipse.jetty.server.ResourceService.sendDirectory(ResourceService.java:530)
at org.eclipse.jetty.server/org.eclipse.jetty.server.ResourceService.sendWelcome(ResourceService.java:438)
at org.eclipse.jetty.server/org.eclipse.jetty.server.ResourceService.doGet(ResourceService.java:166)
at org.eclipse.jetty.ee10.servlet/org.eclipse.jetty.ee10.servlet.DefaultServlet.doGet(DefaultServlet.java:388)
at [email protected]/jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527)
at [email protected]/jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
at org.eclipse.jetty.ee10.servlet/org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:742)
This is related to https://github.com/eclipse/jetty.project/issues/8462 as well.