Conversation
Withalion
reviewed
Sep 29, 2026
Withalion
left a comment
Collaborator
There was a problem hiding this comment.
See comments below, tests will need some work
| { | ||
| uniquePath = originalPath.path() + '/' + originalPath.baseName() + " (" + QString::number( i ) + ")." + originalPath.completeSuffix(); | ||
| // split on the last dot, so a dot in the base name isn't mistaken for the extension | ||
| uniquePath = originalPath.path() + '/' + originalPath.completeBaseName() + " (" + QString::number( i ) + ")." + originalPath.suffix(); |
Collaborator
There was a problem hiding this comment.
I would replace this with: QStringLiteral("%1/%2 (%3).%4").arg(...)
Collaborator
There was a problem hiding this comment.
This is nice, but it would be better to improve TestCoreUtils::testFindUniquePath
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.
Description
Photo renaming broke for any file with more than one dot in its name. When a rename collided with an existing file, the app inserted the "(1)" counter in the wrong spot instead of right before the file extension.
Fixes: #4135
What changed
CoreUtils::findUniquePath()andAttributeController::renamePhotos()used to split filenames on the first dot to separate name from extension. Both now split on the last dot instead, so only the real extension gets treated as the extension. Added tests for names with multiple dots.Behaviour
site.alpha.beta.jpg>site (1).alpha.beta.jpgsite.alpha.beta.jpg>site.alpha.beta (1).jpg