Repository navigation
JSPWIKI-1162 Replace the target of a link when a page with blanks in its name is renamed again - #554
Open
arturobernalg wants to merge 2 commits into
Open
arturobernalg wants to merge 2 commits into
arturobernalg wants to merge 2 commits into
Conversation
…its name is renamed again DefaultPageRenamer keeps the old name as the text of the link when a name with blanks is renamed, so [My Page] becomes [My Page|My Renamed Page]. The same rule was applied to the target of a link that already had a text, which added a third part: renaming the page again gave [My Page|My Renamed Page|Third Name], and [Text|My Page] became [Text|My Page|My Renamed Page]. The rule now only applies when the name is also the text of the link, so the target is replaced in the other cases.
arturobernalg
force-pushed
the
bug/JSPWIKI-1162
branch
from
October 31, 2026 18:03
36973e8 to
8b74d14
Compare
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.
When a page with blanks in its name is renamed and the referrers are updated, DefaultPageRenamer keeps the old name as the text of the link, so [Test Page] becomes [Test Page|Foo Test]. That is intended. The same rule was also applied to the target of a link that already had a text, which added a third part. Renaming the page a second time gave [Test Page|Foo Test|Bar Test] instead of [Test Page|Bar Test], which is the report in JSPWIKI-1162. A link such as [Alpha|Test Page] already became [Alpha|Test Page|Foo Test] at the first rename.
The rule now only applies when the name is also the text of the link. In the other cases the target is replaced.
Names without blanks, such as CamelCase names, were not affected, and the existing tests for renaming twice use such names, which is why they did not catch it.
Not changed: an anchor stays in the text, so [Test Page#Anchor] becomes [Test Page#Anchor|Foo Test] at the first rename and the second rename replaces the target. A link written with different upper and lower case, such as [test page], is still not renamed.
Tests: 3 new cases in PageRenamerTest (renaming twice with blanks, with an anchor, and a link with a text and a target with blanks). They fail without the change, with the output above, and pass with it. The jspwiki-util, jspwiki-event and jspwiki-main suites pass.