mirror of
https://github.com/beetbox/beets.git
synced 2026-08-22 02:04:57 -04:00
unique_path parses a trailing counter so it can continue from it, but the
pattern is `\.(\d)+$` -- a single-digit group repeated, not a multi-digit
group. group(1) is therefore the last digit only, and the counter restarts
from it:
track.10.mp3 -> track.1.mp3 (expected track.11.mp3)
track.12.mp3 -> track.3.mp3
track.123.mp3 -> track.4.mp3
The returned path still does not exist, so nothing is overwritten, but the
new name sorts before the file it was derived from, and the scan restarts
from a low number when the neighbours are already taken.
Use `\.(\d+)$`. Existing coverage only exercised a single-digit counter
(`x.1.mp3`), which is why this held.