Skip to content

Commit

Permalink
🐛 Fix initial wildcard scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Mar 20, 2024
1 parent a7156e3 commit dbb3d08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/kbn-monaco/src/esql/lib/ast/shared/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,10 @@ function getMatcher(name: string, position: 'start' | 'end' | 'middle' | 'multip
return (resource: string) => resource.startsWith(prefix);
}
if (position === 'multiple-within') {
// make sure to remove the * at the beginning of the name if present
const safeName = name.startsWith('*') ? name.slice(1) : name;
// replace 2 ore more consecutive wildcards with a single one
const setOfChars = name.replace(/\*{2+}/g, '*').split('*');
const setOfChars = safeName.replace(/\*{2+}/g, '*').split('*');
return (resource: string) => {
let index = -1;
return setOfChars.every((char) => {
Expand Down

0 comments on commit dbb3d08

Please sign in to comment.