Skip to content

Escape path queries for SQLite #1146

@sampsyo

Description

@sampsyo

Path queries in beets use the SQLite LIKE operator to search subdirectories. For example, beet ls /foo generates an SQL expression like path LIKE '/foo/%'. This can fail when the path contains characters that SQLite wants to interpret specially. Specifically, if there's an underscore in the path, SQLite matches any character in that position.

We should escape _ and % in these strings before sending them to SQLite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugs that are confirmed and actionable

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions