From f0c81bf35011a7a613fb774d71c462f2da33e734 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Mon, 26 Jun 2023 19:12:45 +0200 Subject: [PATCH] #9972 tentative fix Signed-off-by: Ludovic Orban --- .../eclipse/jetty/ee10/servlet/ServletContextHandler.java | 4 ---- .../org/eclipse/jetty/ee10/webapp/WebAppContextTest.java | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java index d7393b17b5f5..25ae45f0aa8d 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java @@ -2829,10 +2829,6 @@ public InputStream getResourceAsStream(String path) @Override public Set getResourcePaths(String path) { - // This is an API call from the application which may pass non-canonical paths. - // Thus, we canonicalize here, to avoid the enforcement of canonical paths in - // ContextHandler.this.getResource(path). - path = URIUtil.canonicalPath(path); if (path == null) return null; return ServletContextHandler.this.getResourcePaths(path); diff --git a/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/WebAppContextTest.java b/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/WebAppContextTest.java index f2ea0e98926b..cafc45475364 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/WebAppContextTest.java +++ b/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/WebAppContextTest.java @@ -67,6 +67,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.instanceOf; @@ -563,6 +564,10 @@ public void testGetResourcePaths() throws Exception """); assertThat(response, startsWith("HTTP/1.1 200 OK")); + assertThat(response, containsString("/WEB-INF")); + assertThat(response, containsString("/WEB-INF/lib")); + assertThat(response, containsString("/WEB-INF/lib/odd-resource.jar")); + assertThat(response, containsString("/nested-reserved-!#\\\\$%&()*+,:=?@[]-meta-inf-resource.txt")); }