From e14191ed050f8062d5d36c4b95155964fc1209bb Mon Sep 17 00:00:00 2001 From: spaceage64 <115997715+spaceage64@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:45:59 +0100 Subject: [PATCH] This PR improves the regex detection used for the drive_sep_replace default. --- beets/dbcore/db.py | 4 ++-- docs/changelog.rst | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/beets/dbcore/db.py b/beets/dbcore/db.py index 9d7469689..ca60f50ca 100755 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -159,8 +159,8 @@ class FormattedMapping(Mapping[str, str]): sep_repl: str = beets.config["path_sep_replace"].as_str() sep_drive: str = beets.config["drive_sep_replace"].as_str() - if re.match(r"^\w:", value): - value = re.sub(r"(?<=^\w):", sep_drive, value) + if re.match(r"^[a-zA-Z]:", value): + value = re.sub(r"(?<=[a-zA-Z]):", sep_drive, value) for sep in (os.path.sep, os.path.altsep): if sep: diff --git a/docs/changelog.rst b/docs/changelog.rst index 1ac16a8e2..6dbaa9e73 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -106,6 +106,9 @@ Bug fixes ``duplicate_action`` config options were silently ignored for as-is imports. - :doc:`/plugins/convert`: Fix extension substitution inside path of the exported playlist. +- :ref:`replace`: Made ``drive_sep_replace`` regex logic more precise to prevent + edge-case mismatches (e.g., a song titled "1:00 AM" would incorrectly be + considered a Windows drive path). For plugin developers ~~~~~~~~~~~~~~~~~~~~~