fix(RemoteFilesystem): 添加glob时无法匹配搜索目录根层文件#2343
Merged
jujn merged 1 commit intoJul 22, 2026
Merged
Conversation
- 添加了测试用例验证**模式匹配根目录和子目录中的文件 - 添加了测试用例验证双星号模式匹配根目录和子目录中的所有文件 - 实现了对以**开头的模式进行直接路径匹配的逻辑 - 确保递归匹配器能够正确匹配搜索根目录中的文件
Contributor
Author
|
@jujn 我提交了一个bug fix,我们生产使用时遇到的问题,我提交的issue中有详细的问题说明和复现过程,pr中有问题原因分析和修复方案。 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
approved these changes
Jul 21, 2026
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Changes look good.
Automated review by github-manager-bot
Contributor
Author
|
@jujn 我貌似没有合并权限,能否麻烦您帮忙操作合并一下,万分感谢! |
Collaborator
OK. I'll watch it tonight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #2342
原因分析
RemoteFilesystem.glob()当前创建了两个PathMatcher:当调用参数为:
两个匹配器实际上完全相同:
在 Windows JDK 17 中,该模式会被编译为类似正则:
它要求
hello.txt前面至少存在一个路径分隔符,因此:可以通过以下代码验证:
RemoteFilesystem.glob()在搜索根路径/时,会把 Store key:正确转换为相对路径:
但随后使用
glob:**/hello.txt进行匹配,导致该文件被过滤。相关实现对比
CompositeFilesystem.glob()已经处理了相同的 Java NIO glob 行为:但
RemoteFilesystem.glob()没有采用相同逻辑,因此其中的directMatcher无法匹配根层文件。修复
在
RemoteFilesystem.glob()中为直接匹配器去掉开头的**/:这样对于:
可以得到:
从而同时匹配: