Browse Source

Merge branch '3.4.x'

pull/44500/head
Andy Wilkinson 11 months ago
parent
commit
162be9670d
  1. 9
      spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/resources/Resources.java

9
spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/resources/Resources.java

@ -113,13 +113,14 @@ class Resources { @@ -113,13 +113,14 @@ class Resources {
}
private void register(String name, Resource resource) {
this.resources.put(name, resource);
String normalized = name.replace("\\", "/");
this.resources.put(normalized, resource);
if (Files.isDirectory(resource.path())) {
if (name.endsWith("/")) {
this.resources.put(name.substring(0, name.length() - 1), resource);
if (normalized.endsWith("/")) {
this.resources.put(normalized.substring(0, normalized.length() - 1), resource);
}
else {
this.resources.put(name + "/", resource);
this.resources.put(normalized + "/", resource);
}
}
}

Loading…
Cancel
Save