diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java index 84ce28d1a1ae7..e717aea3b5ee1 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java @@ -75,8 +75,13 @@ private static int glob(String glob, int i, int length, String stopChars, String switch (current) { case '*': if (i < length && glob.charAt(i) == '*') { - result.append(".*"); i++; + if (i < length && glob.charAt(i) == '/') { + result.append("([^/]*/)*"); + i++; + } else { + result.append(".*"); + } } else { result.append("[^/]*"); } diff --git a/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/util/GlobUtilTest.java b/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/util/GlobUtilTest.java index 7ec0ebecdd943..ac10345eb401a 100644 --- a/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/util/GlobUtilTest.java +++ b/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/util/GlobUtilTest.java @@ -34,6 +34,8 @@ void doubleStar() { assertMatch("a**/b", Arrays.asList("a/b", "axy/b", "a/x/b"), Arrays.asList("a", "b", "a/bc", "bc/b")); assertMatch("a**b", Arrays.asList("ab", "axb", "axyb", "a/b", "a/x/b"), Arrays.asList("abc", "1ab")); assertMatch("a**b**/c", Arrays.asList("axbx/c", "axbx/c", "a/x/xbx/c", "axbx/xxx/c"), Arrays.asList("axbx/cc")); + assertMatch("**/*.txt", Arrays.asList("/test.txt", "test.txt", "/path/to/a.txt", "relative/path/to/a.txt"), + Arrays.asList("/test.py", "test.json", "/path/to/a.js", "relative/path/to/a.exe")); } @Test