There are 4 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-dea77d11-2e3b-4a6c-840f-b696b90a3fa2 XWIKI-24413 In Progress

Absolute image and space references to a renamed page are not updated in pages moved along with it

 
View issue   ยท   Add comment
 

4 updates

 
cid:jira-generated-image-avatar-487866b6-e0de-4642-842e-2b1e358d1393 Changes by Vincent Massol on 07/Oct/26 18:15
 
Summary: Image reference is Absolute image and space references to a renamed page are not updated after page rename when parent page name contains special characters in pages moved along with it
Description: Steps to reproduce:

1. # Create a top-level page named: "page-name" {{red}} .
2. # Create a child page of "page-name" named "example-page".
3. Inside "example-page", insert
{{green}} under {{red}} and upload an image via the WYSIWYG editor named " {{ example.png " }} to it .
Example syntax # Create a child page {{blue}} under {{green}} with the following content :
{code
:java }
[[image:
red.green.WebHome@ example.png]]
{code}
4 [[green>>doc:red . Create a child page of "example-page" named "child-example-page" green . WebHome]]
5. Inside "child-example-page", reference the image from "example-page" using:
{code:java}
[[ image green space>>space : page-name red . example-page.WebHome@example.png green ]]
{code}
6. # Rename the top-level page "page-name" {{red}} to {{pink}}, keeping " page-renamed". Make sure the " Update links" option remains checked (default behavior ).
7 # View {{pink . Open "child-example-page" green . blue}}.

Actual result:
The the image is no longer displayed. The source of "child-example-page" still contains Only the old document link has been updated; the image reference and the space link still target the old location :
{code
:java }
[[image:
example-page red . green. WebHome@example.png]]

[[green>>doc:pink.green.WebHome]]

[[green space>>space:red.green]]
{code}
The image reference is not updated after the rename operation.

Expected result: The image reference should be automatically all three references are updated after the rename :
{code
:java }
[[image:
example-page pink . green. WebHome@example.png]]

[[green>>doc:pink.green.WebHome]]

[[green space>>space:pink.green]]
{code}
The image should continue to be displayed correctly.
Notes:
* The issue reproduces if problem happens when the page name contains special characters holding the reference is itself moved by the same rename ( tested e.g. a child of the renamed page) and reproduced for { the reference is absolute. When the page holding the reference is not part of the move, the reference is updated correctly.
* } Page names don't matter: it reproduces with plain names as well as with names containing spaces, dashes , underscore{ or underscores.
* It doesn't matter whether the image reference is typed ({{attach:red.green.WebHome@example.png } } ) , (but or not with page names like "pageName") .
Assignee: Vincent Massol
Status: Open In Progress
 
 

1 comment

 
cid:jira-generated-image-avatar-487866b6-e0de-4642-842e-2b1e358d1393 Vincent Massol on 07/Oct/26 18:19
 

Updated the title and description after analysis: the problem is not related to special characters in page names (as Marius Dumitru Florea showed, it also reproduces with plain names). It happens when the page holding the reference is moved by the same rename (a child of the renamed page) and the reference is an absolute reference to an attachment (image) or to a space (space: link). Document links are not affected.

Root cause: in ResourceReferenceRenamer#updateAbsoluteResourceReference(), the check deciding whether a reference is absolute compared the document reference the link resolves to with the entity reference the link resolves to. For a document link both are document references so they match, but for an image the entity is an attachment reference and for a space link it's a space reference, so the check never matched. Since the page holding the reference is part of the move, the fallback ("the current document is not moved") doesn't apply either, and the reference is left untouched.

Fix: compare the entity references themselves (reusing the existing isAbsoluteReferenceToDocument() helper), with unit tests for both the image and the space link cases.