mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
AK: Allow trailing '*'s in a glob pattern to match nothing
Fixes part of #4607.
This commit is contained in:
parent
2ad5bfd78e
commit
cbe0a8b403
2 changed files with 16 additions and 0 deletions
|
@ -93,6 +93,14 @@ bool matches(const StringView& str, const StringView& mask, CaseSensitivity case
|
|||
++mask_ptr;
|
||||
}
|
||||
|
||||
if (string_ptr == string_end) {
|
||||
// Allow ending '*' to contain nothing.
|
||||
while (mask_ptr != mask_end && *mask_ptr == '*') {
|
||||
record_span(string_ptr - string_start, 0);
|
||||
++mask_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
return string_ptr == string_end && mask_ptr == mask_end;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue