This PR improves the regex detection used for the drive_sep_replace default.

This commit is contained in:
spaceage64 2026-03-06 16:45:59 +01:00 committed by Šarūnas Nejus
parent 80d08ed11b
commit e14191ed05
2 changed files with 5 additions and 2 deletions

View file

@ -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:

View file

@ -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
~~~~~~~~~~~~~~~~~~~~~