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

JS function XWiki.Document#getURL does not take into account the wiki name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 15.0
    • None
    • Unknown

    Description

      Steps to reproduce

      Compute the view URL of a Document located in a subwiki, by executing the code below in a JSX:

      const reference = XWiki.Model.resolve('WebHome', XWiki.EntityType.DOCUMENT, ['mywiki', 'Sandbox']);
      const page = new XWiki.Document(reference);
      console.log('View URL', page.getURL());
      console.log('REST URL', page.getRestURL());
      

      Actual result

      The printed view URL points at the main wiki: /xwiki/bin/view/Sandbox/WebHome, while an URL taking account the passed subwiki is expected.

      The printed REST view URL is, as expected, /xwiki/rest/wikis/mywiki/spaces/Sandbox/pages/WebHome. It's however more difficult to compute the view URL than the REST one since the former depends whether the multiwiki configuration is set to domain based or path based.

      Attachments

        Activity

          People

            Unassigned Unassigned
            slauriere slauriere
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: