fix: improve file naming logic in get_next_available_path #529
Open
fdrgsp wants to merge 3 commits into
Open
Conversation
…nrelated files correctly
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #529 +/- ##
=======================================
Coverage 86.87% 86.87%
=======================================
Files 115 115
Lines 14093 14097 +4
=======================================
+ Hits 12243 12247 +4
Misses 1850 1850 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Update the
get_next_available_pathfunction...I found it weird that when requestingtest.ome.tiffin a folder that had notest*.ome.tifffiles (but contained other unrelated.ome.tifffiles (e.g.,other_009.ome.tiff)) the result wastest_010.ome.tiffinstead of the expectedtest.ome.tiff.The issue was that the glob pattern
*.ome.tiffmatched all.ome.tifffiles in the directory, not just those sharing the same stem. This caused unrelated files' counters to influence the result. Fixed by scoping the glob to{stem}*.ome.tiff.New behavior:
Basic: no existing files in directory
test.ome.tifftest.ome.tifftest_001.ome.tifftest_001.ome.tifftest_02.ome.tifftest_02.ome.tifftest.ome.tiffexists in directorytest.ome.tifftest_001.ome.tifftest.ome.tiffandtest_004.ome.tiffexisttest.ome.tifftest_005.ome.tifftest_003.ome.tifftest_005.ome.tifftest_010.ome.tifftest_010.ome.tifftest_02.ome.tifftest_02.ome.tiff_02is not a counter (< 3 digits), treated as distinct stem, notest_02*files existBug fix:
other_009.ome.tiffexists (unrelated file)test.ome.tifftest_010.ome.tifftest.ome.tiff*.ome.tiffmatched unrelated files; new globtest*.ome.tiffscopes to same stemtest.ome.tiff(after creating it)test_010.ome.tifftest_001.ome.tifftest_*filestest_999.ome.tiffexists (digit overflow)test.ome.tifftest_1000.ome.tifftest_12345.ome.tiffexists (high counter)test_12345.ome.tifftest_12346.ome.tiff