Skip to content

Commit 5d80d75

Browse files
committed
Follow symlinks during root path traversal
Closes gh-33424
1 parent debba65 commit 5d80d75

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.net.URLConnection;
3535
import java.nio.file.FileSystemNotFoundException;
3636
import java.nio.file.FileSystems;
37+
import java.nio.file.FileVisitOption;
3738
import java.nio.file.Files;
3839
import java.nio.file.Path;
3940
import java.util.Collections;
@@ -871,7 +872,7 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
871872
.formatted(rootPath.toAbsolutePath(), subPattern));
872873
}
873874

874-
try (Stream<Path> files = Files.walk(rootPath)) {
875+
try (Stream<Path> files = Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)) {
875876
files.filter(isMatchingFile).sorted().map(FileSystemResource::new).forEach(result::add);
876877
}
877878
catch (Exception ex) {

0 commit comments

Comments
 (0)