This issue has been created
There are 2 updates.
 
 
Cached Code Macro / cid:jira-generated-image-avatar-16b805f9-730d-49cc-ad9a-b678525321e1 CODECACHE-5 Open

Relative links and images in the title and image parameters point to Main.WebHome when the code macro is rendered asynchronously

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f0c22fdf-6fa7-4fd8-ba29-21e0ce4412fe Vincent Massol created this issue on 12/Nov/26 11:31
 
Summary: Relative links and images in the title and image parameters point to Main.WebHome when the code macro is rendered asynchronously
Issue Type: cid:jira-generated-image-avatar-16b805f9-730d-49cc-ad9a-b678525321e1 Bug
Affects Versions: 1.0
Assignee: Unassigned
Created: 12/Nov/26 11:31
Priority: cid:jira-generated-image-static-major-11def2c3-8dad-45d7-a19e-77768b2bdb41 Major
Reporter: Vincent Massol
Description:

When the code macro result is computed asynchronously (the default, codecached.async=true), the relative references found in the title and image parameters are resolved against Main.WebHome instead of the page containing the macro. So the first time the page is displayed (before the result is cached), the links and images in the box title point to the wrong page.

Steps to reproduce

  • Create a page Sandbox.Test with the following content:
    {{code title="See [[Child]] and [[attach:file.txt]]" image="pic.png" language="none"}}some content{{/code}}
    
  • View the page (first view, the macro is rendered asynchronously)

Result

  • The image points to /xwiki/bin/download/Main/WebHome/pic.png
  • The Child link points to /xwiki/bin/create/Main/Child/WebHome?parent=Main.WebHome
  • The attachment link points to /xwiki/bin/download/Main/WebHome/file.txt

Expected

The references are resolved relative to the page containing the macro, i.e. /xwiki/bin/download/Sandbox/Test/WebHome/pic.png, etc.

Once the result is cached, the next views are correct, since the cached blocks are then rendered by the page itself.

The reason is that the asynchronous job is executed without any context document.

 
 

2 updates

 
cid:jira-generated-image-avatar-f0c22fdf-6fa7-4fd8-ba29-21e0ce4412fe Changes by Vincent Massol on 12/Nov/26 11:31
 
Fix Version: 1.1
Assignee: Vincent Massol