Improve regex detection for the drive_sep_replace default#6417
Improve regex detection for the drive_sep_replace default#6417snejus merged 5 commits intobeetbox:masterfrom
Conversation
|
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. |
06ee591 to
a6951bf
Compare
|
I see I failed one formatting test for the changelog. Can someone advise on this? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6417 +/- ##
=======================================
Coverage 69.42% 69.42%
=======================================
Files 141 141
Lines 18452 18452
Branches 3020 3020
=======================================
Hits 12811 12811
Misses 5004 5004
Partials 637 637
🚀 New features to boost your workflow:
|
Try running |
a6951bf to
9c8dce8
Compare
Thanks but have and this error remains. Maybe I'm doing something wrong, but I don't know what. I only added an entry to the changelog, nothing special. No idea why the test would consider the formatting an issue now? |
|
Ah I see what's happening - you're using a new Run |
9c8dce8 to
dc3410f
Compare
dc3410f to
7b26733
Compare
snejus
left a comment
There was a problem hiding this comment.
Thanks! We will improve this further later :)
7b26733 to
e14191e
Compare
|
Ah one last thing - we've had a couple of releases since this PR was submitted - would you mind moving your changelog note to the top, under the Unreleased section? |
Description
I imported an album where a track had the name
1:00 AM - Clearand another track named12:00 AM - Clear(just two examples).See: Animal Crossing: New Horizons OST
After import, the former was renamed
1_00 AM - Clear, and the latter12;00 AM - Clear. Notice the inconsistency of how the:was replaced.I did not make use of the (hidden)
drive_sep_replacesetting. These were myreplacesettings:I found the issue to be too generic regex for drive separator detection. I'm on macOS, so this is irrelevant to me anyway (and I got around it by adding
drive_sep_replace: ';'to my settings), but regardless, I think this could be improved.This PR improves the regex to detect drive separators. Instead of merely looking for any first character followed by a colon (
^\w:), we look for a letter, followed by a colon, followed by a backslash instead (^[a-zA-Z]:\\).The regex logic is solid, but I am not able to test this on a real Windows environment.
Still have to add an entry to the changelog, will do so soon.Update
Initially this commit failed the
MoveTest.test_move_file_with_colon_alt_separatortest because it checks the logic using aC:DOSpath. So I had to make the logic less restrictive again, not checking for a backslash (^[a-zA-Z]:). I would argue the test itself should be amended (test withC:\DOSinstead), but that's not up to me.As a result, my case of "1:00 AM" being replaced incorrectly is still resolved, but other hypothetical cases like "a:b" would still not be covered due to an arguably incorrect test limiting a more precise regex.
To Do
Documentation.(This is an existing feature, just refined logic)