Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19629

Relative references in links are not resolved correctly by the display macro when using the "page" parameter

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce

      1. Create page Sandbox.A.WebHome with the following content:

      
      = Display page:./B =
      
      {{display page="./B"/}}
      
      = Display page:Sandbox/A/B =
      
      {{display page="Sandbox/A/B"/}}
      
      = Display reference:Sandbox.A.B.WebHome =
      
      {{display reference="Sandbox.A.B.WebHome"}}
      

      2. Create page Sandbox.A.B.WebHome with the following content:

      * [[Relative page link to non-terminal child>>page:./C]]
      * [[Relative page link to terminal child>>page:./D]]
      * [[Relative doc link to terminal child>>doc:D]]
      * [[Relative page link to sibling>>page:../E]]
      * [[Relative page link to parent sibling>>page:../../F]]
      
      {{velocity}}
      * $services.model.resolvePage('./C')
      * $services.model.resolvePage('./D')
      * $services.model.resolveDocument('D')
      * $services.model.resolvePage('../E')
      * $services.model.resolvePage('../../F')
      {{/velocity}}
      
      = Display relative child page:./C =
      
      {{display page="./C"/}}
      
      = Display relative sibling page:../E =
      
      {{display page="../E"/}}
      
      = Display relative parent sibling page:../../F =
      
      {{display page="../../F"/}}
      

      3. Create pages Sandbox.A.B.C.WebHome, Sandbox.A.B.D, Sandbox.A.E.WebHome, Sandbox.F.WebHome with the page name in the content so that the pages can be identified when getting displayed from another page.

      Expected result

      When viewing page Sandbox.A.WebHome, all links are rendered correctly, they point at the same pages as the ones targeted by page Sandbox.A.B.WebHome viewed individually.

      Actual result

      On page Sandbox.A.WebHome, the display macros using the page parameter contain broken links for links targeting a relative child.

      What works as expected though is the following:

      • Links targeting a relative sibling or parent sibling are correct.
      • The content which is included via relative references in included page Sandbox.A.B.WebHome is also included as expected in page Sandbox.A.WebHome.
      • The references computed in Velocity in page Sandbox/A/B are correct, and the display macro using a reference produces the expected result.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              slauriere slauriere
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: