From 7b26733e043cdd25a6f0930120f4d3ddff78ac2c 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 1/4] This PR improves the regex detection used for the drive_sep_replace default. --- beets/dbcore/db.py | 4 ++-- docs/changelog.rst | 3 +++ docs/plugins/duplicates.rst | 6 +++--- docs/plugins/playlist.rst | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/beets/dbcore/db.py b/beets/dbcore/db.py index 30f7ef7cf4..2ffc6dcf9d 100755 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -159,8 +159,8 @@ def _get_formatted(self, model: Model, key: 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 7318057b36..3938036242 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -60,6 +60,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 ~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/plugins/duplicates.rst b/docs/plugins/duplicates.rst index 4580343dec..ed94975e95 100644 --- a/docs/plugins/duplicates.rst +++ b/docs/plugins/duplicates.rst @@ -57,9 +57,9 @@ file. The available options mirror the command-line options: - **delete**: Remove matched items from the library and from the disk. Default: ``no`` - **format**: A specific format with which to print every track or album. This - uses the same template syntax as beets' :doc:`path - formats`. The usage is inspired by, and therefore - similar to, the :ref:`list ` command. Default: :ref:`format_item` + uses the same template syntax as beets' :doc:`path formats + `. The usage is inspired by, and therefore similar to, + the :ref:`list ` command. Default: :ref:`format_item` - **full**: List every track or album that has duplicates, not just the duplicates themselves. Default: ``no`` - **keys**: Define in which track or album fields duplicates are to be searched. diff --git a/docs/plugins/playlist.rst b/docs/plugins/playlist.rst index e89c880add..1c12755435 100644 --- a/docs/plugins/playlist.rst +++ b/docs/plugins/playlist.rst @@ -29,10 +29,10 @@ searched in the playlist_dir and the ".m3u" extension is appended to the name: $ beet ls playlist:anotherplaylist A playlist query will use the paths found in the playlist file to match items in -the beets library. ``playlist:`` submits a regular beets :ref:`query` -similar to a :ref:`specific fields query`. If you want the list in +the beets library. ``playlist:`` submits a regular beets :ref:`query ` +similar to a :ref:`specific fields query `. If you want the list in any particular order, you can use the standard beets query syntax for -:ref:`sorting`: +:ref:`sorting `: :: 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 2/4] 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 9d7469689c..ca60f50caa 100755 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -159,8 +159,8 @@ def _get_formatted(self, model: Model, key: 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 1ac16a8e27..6dbaa9e73e 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 ~~~~~~~~~~~~~~~~~~~~~ From 031c2a8aeb2ba54c38e6ebd2a73531c30c016b03 Mon Sep 17 00:00:00 2001 From: spaceage64 <115997715+spaceage64@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:09:32 +0100 Subject: [PATCH 3/4] Moved changelog note to top, under Unreleased. --- docs/changelog.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 3938036242..9f6b454a3b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -41,6 +41,9 @@ New features Bug fixes ~~~~~~~~~ +- :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). - :doc:`plugins/ftintitle`: Fix handling of multiple featured artists with ampersand. - :doc:`plugins/zero`: When the ``omit_single_disc`` option is set, @@ -60,9 +63,6 @@ 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 ~~~~~~~~~~~~~~~~~~~~~ From fbe9495bdd4d1ca42805aae3ba606c4d8a6bd1cb Mon Sep 17 00:00:00 2001 From: spaceage64 <115997715+spaceage64@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:22:23 +0100 Subject: [PATCH 4/4] Pulled latest changelog and added my entry to 'Unreleased > Bug fixes' section. --- docs/changelog.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 32cccf4292..4a944484f7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,9 @@ Unreleased Bug fixes ~~~~~~~~~ +- :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). - :doc:`plugins/fish`: Fix AttributeError. :bug:`6340` .. @@ -87,9 +90,6 @@ New features Bug fixes ~~~~~~~~~ -- :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). - :doc:`plugins/ftintitle`: Fix handling of multiple featured artists with ampersand. - :doc:`plugins/zero`: When the ``omit_single_disc`` option is set, @@ -109,9 +109,6 @@ 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 ~~~~~~~~~~~~~~~~~~~~~