Skip to content

Commit 5e487fd

Browse files
authored
[Tests] Avoid having slash to be the first char of wildcard (#70010)
The openning slash char has the special meaning of being a lucene regex.
1 parent 8a9da1d commit 5e487fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public void testSingleQuestionMark() throws Exception {
4545

4646
public void testUnicodeWildcard() throws Exception {
4747
// Lucene automatons don't work correctly on strings with high surrogates
48-
final String prefix = randomValueOtherThanMany(s -> StringMatcherTests.hasHighSurrogate(s) || s.contains("\\"),
48+
final String prefix = randomValueOtherThanMany(
49+
s -> StringMatcherTests.hasHighSurrogate(s) || s.contains("\\") || s.startsWith("/"),
4950
() -> randomRealisticUnicodeOfLengthBetween(3, 5));
5051
final StringMatcher matcher = StringMatcher.of(prefix + "*");
5152
for (int i = 0; i < 10; i++) {

0 commit comments

Comments
 (0)