Skip to content

Incorrect behavior of beets.util.config.sanitize_choices() #6301

@xbt573

Description

@xbt573

Problem

Provided sources: 'lrclib' to lyrics plugin does nothing.

It seems that sanitize_choices() iterates over choices sequence as a string, resulting in iteration of string characters, not members of stringlist.

I managed to hack this issue with this patch:

diff --git a/beets/util/config.py b/beets/util/config.py
index 218a9d1..35a0322 100644
--- a/beets/util/config.py
+++ b/beets/util/config.py
@@ -16,7 +16,7 @@ def sanitize_choices(
     seen: set[str] = set()
     others = [x for x in choices_all if x not in choices]
     res: list[str] = []
-    for s in choices:
+    for s in choices.split():
         if s not in seen:
             if s in list(choices_all):
                 res.append(s)

Setup

  • OS: Alpine Linux v3.23
  • Python version: 3.12.12
  • beets version: 2.5.1 (pipx)
  • Turning off plugins made problem go away (yes/no): probably universal to all plugins that use this function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions