Restore directory matching (explicitly excluding root path itself)

Closes gh-29333
This commit is contained in:
Juergen Hoeller
2022-10-18 19:29:29 +02:00
parent d89865ad67
commit d17cdf98bb
2 changed files with 7 additions and 12 deletions

View File

@@ -781,8 +781,9 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
rootDir += "/";
}
Path rootPathForPattern = rootPath;
String resourcePattern = rootDir + StringUtils.cleanPath(subPattern);
Predicate<Path> isMatchingFile = path -> (Files.isRegularFile(path) &&
Predicate<Path> isMatchingFile = path -> (!path.equals(rootPathForPattern) &&
getPathMatcher().match(resourcePattern, StringUtils.cleanPath(path.toString())));
if (logger.isTraceEnabled()) {