Merge branch '7.0.x'

Closes gh-36753
This commit is contained in:
Brian Clozel
2026-05-05 11:59:37 +02:00
4 changed files with 0 additions and 20 deletions
@@ -74,9 +74,6 @@ public abstract class ResourceHandlerUtils {
}
else if (location instanceof ContextResource contextResource) {
path = contextResource.getPathWithinContext();
Assert.isTrue(!"/".equals(path),
() -> "Resource location '" + location + "' is considered unsafe " +
"and cannot be used as it provides access to the root servlet context.");
}
else if (location instanceof UrlResource) {
path = location.getURL().toExternalForm();
@@ -82,13 +82,6 @@ class ResourceHandlerUtilsTests {
.withMessageContaining("is considered unsafe");
}
@Test
void assertResourceLocationShouldRejectUnsafeContextResource() {
assertThatIllegalArgumentException().isThrownBy(() ->
ResourceHandlerUtils.assertResourceLocation(new TestContextResource("/")))
.withMessageContaining("is considered unsafe");
}
private static class TestContextResource implements ContextResource {
private final String path;