adobe / aem-core-email-components

Apache License 2.0
13 stars 11 forks source link

Externalization errors #206

Open edoardo-goracci opened 2 years ago

edoardo-goracci commented 2 years ago

Links with relative urls to an anchor (starting with "#" character) on Button, Teaser and Title component gets externalized when the page gets rendered in WCM mode disabled.

For example: (TItle component)

image

WCM mode disabled:

<h1 class="cmp-title__text">
    <a x-cq-linkchecker="skip" class="cmp-title__link" href="http://192.168.1.50/#anchor1">Anchor 1 link</a>
</h1>
edoardo-goracci commented 2 years ago

I added a PR for a UrlMapperServiceImpl fix: now absolute and relative anchor urls are not externalized anymore. With this change, rendering the page in disabled WCM mode works fine, but when the page is transferred to ACC (using the POST call which triggers StylesInlinerFilter), the urls are externalized again.

I debugged it, and it seems that after invoking the filter chain (in StylesInlinerFilter)

filterChain.doFilter(request, wrapper);

the page is retrieved and stored in the InlinerResponseWrapper object, but the anchor urls are still externalized. I tried further analysis, but I can't figure out what externalizes this urls. I even tried debugging WCMDeveloperModeFilter (Day Communique 5 WCM Core Implementation bundle) but I didn't find anything.

Example POST call to my local environment (using postman):

http://192.168.1.50:4502/content/campaigns/core-email-components-examples/master/core-email-spender/aaa.campaign.content.json?delivery=DM254

bpauli commented 1 year ago

Hey @edoardo-goracci, the url still gets externalised because of the LinkTransformer of the campaign bundle. In https://github.com/adobe/aem-core-email-components/pull/202 @Buuhuu started to work on a custom transformer for the email core component project. We will fix this issue in this PR. For now I will revert your PR. Thank you for the contribution and the hands up!