Repository navigation
Fix --from-logfile parsing when semicolons appear in paths - #7185
Merged
snejus merged 6 commits intoNov 19, 2026
Merged
Conversation
When a path contains semicolons (e.g. in artist or directory names), splitting on '; ' split the path across multiple chunks. When the subsequent chunks were relative, os.path.commonpath raised ValueError: Can't mix absolute and relative paths. This commit merges non-absolute segments back into preceding absolute paths before computing the commonpath. Fixes beetbox#4941
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7185 +/- ##
=======================================
Coverage 80.86% 80.87%
=======================================
Files 150 150
Lines 21234 21244 +10
Branches 3242 3245 +3
=======================================
+ Hits 17171 17181 +10
Misses 3249 3249
Partials 814 814
🚀 New features to boost your workflow:
|
snejus
requested changes
Nov 19, 2026
snejus
left a comment
Member
There was a problem hiding this comment.
Looks good - but create a function for this logic for maintainability reasons where the docstring explains what's happening there.
Also add a note to the changelog.
snejus
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #4941.
When importing from a log file (
beet import --from-logfile ...), paths recorded in the log file were split withpaths.split("; "). If any path contained a semicolon in a directory or file name (e.g.Band; The/Album), it was split into multiple chunks where subsequent chunks were relative. Passing mixed absolute and relative segments toos.path.commonpath()raised:Solution
In
paths_from_logfile, when log lines contain absolute paths, merge any subsequent non-absolute chunks back into the preceding absolute path before computingos.path.commonpath().Tests
Added regression tests covering paths containing semicolons in directory names for both Windows and POSIX path formats.