Skip to content

Commit cfe4d00

Browse files
author
core-lib
committed
修复ANT路径表达式**/*无法匹配当前目录的问题
1 parent 7d42178 commit cfe4d00

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ JDK 1.5 +
3131
<dependency>
3232
<groupId>com.github.core-lib</groupId>
3333
<artifactId>loadkit</artifactId>
34-
<version>v1.0.0</version>
34+
<version>v1.0.1</version>
3535
</dependency>
3636
</dependencies>
3737
</project>
@@ -106,8 +106,9 @@ Filters.any(Filter...filters); // OR 连接的混合过滤器的另一种表达
106106

107107

108108
## 变更记录
109-
110-
* v1.0.0
109+
* v1.0.1
110+
* 修复ANT路径表达式**/*无法匹配当前目录的问题
111+
* v1.0.0
111112
* 第一个正式版发布
112113

113114
## 协议声明

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.loadkit</groupId>
88
<artifactId>loadkit</artifactId>
9-
<version>v1.0.0</version>
9+
<version>v1.0.1</version>
1010

1111
<name>loadkit</name>
1212

src/main/java/io/loadkit/AntFilter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ public AntFilter(String ant) {
2222
private static String convert(String ant) {
2323
String regex = ant;
2424
for (String symbol : SYMBOLS) regex = regex.replace(symbol, '\\' + symbol);
25-
regex = regex.replace("**", ".{0,}");
26-
regex = regex.replace("*", "[^/]{0,}");
2725
regex = regex.replace("?", ".{1}");
26+
regex = regex.replace("**/", "(.{0,}?/){0,}?");
27+
regex = regex.replace("**", ".{0,}?");
28+
regex = regex.replace("*", "[^/]{0,}?");
2829
while (regex.startsWith("/")) regex = regex.substring(1);
2930
while (regex.endsWith("/")) regex = regex.substring(0, regex.length() - 1);
3031
return regex;

0 commit comments

Comments
 (0)