Skip to content

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
apache:masterfrom
arturobernalg:bug/JSPWIKI-1162
Open

arturobernalg wants to merge 2 commits into
apache:masterfrom
arturobernalg:bug/JSPWIKI-1162

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant