adobe / aem-spa-page-model-manager

Interface between Adobe Experience Manager and Single Page Application framework.
Apache License 2.0
33 stars 24 forks source link

[bug] - If page is called with suffix (e.g. /page.html/suffix) it result in wrong URL for model.json #94

Open marcinczeczko opened 1 year ago

marcinczeczko commented 1 year ago

Describe the bug Calling the page with the suffix /content/site/page.html/suffix result in a wrong URL for model.json for that page that looks like /content/site/page.model.jsonsuffix

Looking at the code it seems that the PathUtil._replaceExtension misses first / See here: https://github.com/adobe/aem-spa-page-model-manager/blob/3b040b77f8afc07bfe9bc19d52ee00d76b8e22af/src/PathUtils.ts#L291

Looks like the line 291 should be path += '/' + slingElementsWithoutResource.join('/');

Package version 1.4.0, but issue is present in the master too

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior Calling the page with the suffix /content/site/page.html/suffix should call for model.json with a proper URL which is /content/site/page.mode.json/suffix

Screenshots N/A

Additional context N/A