Browse Source

Merge branch '2.3.x'

Closes gh-24043
pull/24076/head
Scott Frederick 5 years ago
parent
commit
8f39ebf781
  1. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
  2. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/LocationResourceLoader.java
  3. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/ConfigTreePropertySource.java
  4. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java
  5. 0
      spring-boot-project/spring-boot/src/test/resources/config/..hidden/testproperties.properties

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java

@ -554,7 +554,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, @@ -554,7 +554,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
private boolean hasHiddenPathElement(Resource resource) throws IOException {
String cleanPath = StringUtils.cleanPath(resource.getFile().getAbsolutePath());
for (Path value : Paths.get(cleanPath)) {
if (value.toString().startsWith(".")) {
if (value.toString().startsWith("..")) {
return true;
}
}

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/LocationResourceLoader.java

@ -144,7 +144,7 @@ class LocationResourceLoader { @@ -144,7 +144,7 @@ class LocationResourceLoader {
}
private boolean isVisibleDirectory(File file) {
return file.isDirectory() && !file.getName().startsWith(".");
return file.isDirectory() && !file.getName().startsWith("..");
}
/**

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/ConfigTreePropertySource.java vendored

@ -226,7 +226,7 @@ public class ConfigTreePropertySource extends EnumerablePropertySource<Path> imp @@ -226,7 +226,7 @@ public class ConfigTreePropertySource extends EnumerablePropertySource<Path> imp
private static boolean hasHiddenPathElement(Path path) {
Iterator<Path> iterator = path.iterator();
while (iterator.hasNext()) {
if (iterator.next().toString().startsWith(".")) {
if (iterator.next().toString().startsWith("..")) {
return true;
}
}

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/LocationResourceLoaderTests.java

@ -129,7 +129,7 @@ class LocationResourceLoaderTests { @@ -129,7 +129,7 @@ class LocationResourceLoaderTests {
@Test
void getResourcesWhenHasHiddenDirectoriesFiltersResults() throws IOException {
createTree();
File hiddenDirectory = new File(this.temp, ".a");
File hiddenDirectory = new File(this.temp, "..a");
hiddenDirectory.mkdirs();
FileCopyUtils.copy("h".getBytes(), new File(hiddenDirectory, "file"));
Resource[] resources = this.loader.getResources(this.temp.getAbsolutePath() + "/*/file", ResourceType.FILE);

0
spring-boot-project/spring-boot/src/test/resources/config/.hidden/testproperties.properties → spring-boot-project/spring-boot/src/test/resources/config/..hidden/testproperties.properties

Loading…
Cancel
Save