Fix: trim whitespace in tileset name when renaming#4495
Open
Praagya26 wants to merge 1 commit intomapeditor:masterfrom
Open
Fix: trim whitespace in tileset name when renaming#4495Praagya26 wants to merge 1 commit intomapeditor:masterfrom
Praagya26 wants to merge 1 commit intomapeditor:masterfrom
Conversation
Contributor
|
😅 you can actually just push extra commits to your existing branch for #4486. It’ll update that PR automatically so we can keep all these whitespace fixes in one place for Bjorn to review. It saves everyone some clicks if we group them! (let's see what bjorn's take on naming validation idea, though implementing that won't be a cup of tea ) |
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:
Fix:
Applied QString::trimmed() to sanitize input:
In tilesetchanges.cpp using newName.trimmed()
In tilesetdocument.cpp using name.trimmed()
This ensures:
Whitespace-only names are rejected.
Leading and trailing spaces are removed before further processing.
Result:
Prevents invalid or empty tileset names.
Improves consistency and reliability of naming behavior.
Future Work:
As suggested by @kunal649, consider introducing a CENTRALIZED VALIDATION UTILITY.
This would help enforce consistent naming rules across the codebase and reduce duplication.