Repository navigation
Stop dotted sheet names from saving over each other - #9
Merged
Merged
Conversation
_safe_output_path treated everything after the last dot as a file extension and replaced it. So "Sheet A.1" and "Sheet A.2" were both saved as "Sheet A.dwg", and the second save overwrote the first. Now a dot only counts as an extension when two to four ASCII letters follow it, such as .dwg, .pdf, .exe or .jpeg. Any other tail is kept and the target extension is added after it, so "Sheet A.1" is saved as "Sheet A.1.dwg". A real extension is still swapped, so "plan.exe" requested as a PDF is still "plan.pdf". Adds regression tests in tests/test_safe_output_path.py.
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.
Sheets named "Sheet A.1" and "Sheet A.2" both became "Sheet A.dwg", so the second save overwrote the first. A dot is now treated as an extension only when two to four letters follow it. "Sheet A.1" saves to "Sheet A.1.dwg", and plan.exe still saves to plan.dwg. The 52 tests pass, including three new ones.
Limit: a letters-only tail of two to four characters, such as Floor.Plan, can still collide.