Uploaded image for project: 'Cached Code Macro'
  1. Cached Code Macro
  2. CODECACHE-5

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.1
    • 1.0
    • None
    • Unknown

    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.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: