Skip to content

Make glob_to_pattern more reliable when it translates * and ** wildcards #1331

@rakotomandimby

Description

@rakotomandimby

Hello,

The utils.glob_to_pattern function, which converts glob patterns to Lua regex for file searching, has a flaw in its implementation that leads to incorrect file matching.

* is translated incorrectly: The glob * is converted to the Lua pattern .*. This is incorrect because * should not match directory separators (/), but . does. This causes patterns like *.lua to incorrectly match files in subdirectories (e.g., lua/utils.lua).

** is not handled correctly: The glob ** is not specially handled and is treated as two separate *s. This results in an incorrect pattern that does not properly match across multiple directory levels as intended.

I am working on a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions