Skip to content

Commit e6590aa

Browse files
committed
Merge branch '7.0.x'
Closes gh-36753
2 parents 051b096 + 628261d commit e6590aa

4 files changed

Lines changed: 0 additions & 20 deletions

File tree

spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ else if (location instanceof ClassPathResource classPathResource) {
7474
}
7575
else if (location instanceof ContextResource contextResource) {
7676
path = contextResource.getPathWithinContext();
77-
Assert.isTrue(!"/".equals(path),
78-
() -> "Resource location '" + location + "' is considered unsafe " +
79-
"and cannot be used as it provides access to the root servlet context.");
8077
}
8178
else if (location instanceof UrlResource) {
8279
path = location.getURL().toExternalForm();

spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceHandlerUtilsTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ void assertResourceLocationShouldRejectUnsafeClassPathResource() {
8282
.withMessageContaining("is considered unsafe");
8383
}
8484

85-
@Test
86-
void assertResourceLocationShouldRejectUnsafeContextResource() {
87-
assertThatIllegalArgumentException().isThrownBy(() ->
88-
ResourceHandlerUtils.assertResourceLocation(new TestContextResource("/")))
89-
.withMessageContaining("is considered unsafe");
90-
}
91-
9285
private static class TestContextResource implements ContextResource {
9386

9487
private final String path;

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ else if (location instanceof ClassPathResource classPathResource) {
7575
}
7676
else if (location instanceof ContextResource contextResource) {
7777
path = contextResource.getPathWithinContext();
78-
Assert.isTrue(!"/".equals(path),
79-
() -> "Resource location '" + location + "' is considered unsafe " +
80-
"and cannot be used as it provides access to the root servlet context.");
8178
}
8279
else if (location instanceof UrlResource) {
8380
path = location.getURL().toExternalForm();

spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHandlerUtilsTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,4 @@ void assertResourceLocationShouldRejectUnsafeClassPathResource() {
7777
.withMessageContaining("is considered unsafe");
7878
}
7979

80-
@Test
81-
void assertResourceLocationShouldRejectUnsafeContextResource() {
82-
assertThatIllegalArgumentException().isThrownBy(() ->
83-
ResourceHandlerUtils.assertResourceLocation(new ServletContextResource(new MockServletContext(), "/")))
84-
.withMessageContaining("is considered unsafe");
85-
}
86-
8780
}

0 commit comments

Comments
 (0)