Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-345

JcrReferenceResolverDefinition wrongly generating links for cross site and self

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an issue
    • Neutral
    • None
    • 2.2.16
    • None
    • None

    Description

      Steps to reproduce

      1. we have a rest endpoint that resolves links to other pages with reference resolver:
          - name: linkReference
            propertyName: link
            referenceResolver: 
              class: info.magnolia.rest.reference.jcr.JcrReferenceResolverDefinition
              targetWorkspace: website
              expand: false
              generateLink: true
        
      1. we have a component that allows linking
      2. link to page itself
      3. link to page in other site (multisite)

      Expected results

      All links resolved correctly

      Actual results

      Link to self is not resolved
      Link to cross-site is resolved in the wrong way

      Normal link

      {
      "@name": "cta",
      "@path": "/home/bartosz/hero/00/cta",
      "@id": "ad764a41-167e-4acc-a145-71420082391d",
      "@nodeType": "mgnl:contentNode",
      "link": "http://ecommerce-headless-author.magnolia-cms-demo.com/home/TobiasDemo.html",
      "text": "normal",
      "mgnl:createdBy": "jl3r2p5kplieoo3t",
      "mgnl:lastModified": "2022-02-03T15:14:10.069Z",
      "mgnl:lastModifiedBy": "jl3r2p5kplieoo3t",
      "@nodes": []
      }
      

      Link to self

      {
      "@name": "cta",
      "@path": "/home/bartosz/hero/0/cta",
      "@id": "c4d14527-fe8c-421c-90b6-b4fd5a835165",
      "@nodeType": "mgnl:contentNode",
      "text": "link to self",
      "link": "45cbec50-608c-4cf5-bd13-33668a9f2173",
      "mgnl:createdBy": "jl3r2p5kplieoo3t",
      "mgnl:lastModified": "2022-02-03T15:12:54.893Z",
      "mgnl:lastModifiedBy": "jl3r2p5kplieoo3t",
      "@nodes": []
      }
      

      Link to cross site

      {
      "@name": "cta",
      "@path": "/home/bartosz/hero/01/cta",
      "@id": "2a8fa5ac-7062-421c-9d5a-dd95cebb1922",
      "@nodeType": "mgnl:contentNode",
      "text": "other page",
      "link": "http://127.0.0.1:8080/home_ch/en/bathroom.html",
      "mgnl:createdBy": "jl3r2p5kplieoo3t",
      "mgnl:lastModified": "2022-02-03T15:14:31.348Z",
      "mgnl:lastModifiedBy": "jl3r2p5kplieoo3t",
      "@nodes": []
      }
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                dai.ha Dai Ha
                bstaryga Bartosz Staryga
                DeveloperX
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Work Started:

                  Checklists

                    Bug DoR
                    Task DoD