Skip to content

Bug: empty album/title matches every candidate #86

Description

@l3d00m

Disclosure: This has been found with AI and the following has been written by AI. I still thought it'll be helpful

The is_likely_match substring check (beetsplug/audible.py L179) treats an empty string as matching everything, since "" in "anything" is always True in Python:

is_likely_match = (
    normalized_album_name in normalized_book_title
    or normalized_book_title in normalized_album_name
)

If album is missing/blank, or normalizes to "" (e.g. it was only punctuation or "(unabridged)"), every Audible result becomes a likely match. This feeds maybe_align_tracks_with_items, which can then rewrite the wrong book's chapter data.

Fix: require both sides to be non-empty first, e.g. normalized_album_name and normalized_book_title and (...).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions