Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
453 stars 600 forks source link

Versioned ClientLibs no longer works as of 4.12.0 #2568

Closed cshawaus closed 3 years ago

cshawaus commented 3 years ago

AEM Version: 6.5.7 ACS AEM Commons Version: 4.12.0+ Reproducible on Latest? yes

Expected Behavior

Proxied ClientLib paths should correctly output paths with a hash. This works correctly in ACS Commons v4.11.2 and below.

Actual Behavior

As a result of #2528, this behaviour has completely regressed and Versioned ClientLibs no longer generates hashes for proxied ClientLib paths.

Based on my observations, the following is preventing the resolvePath method from succeeding as libraryResource always resolves to /etc.

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/84fcdd4bc66b020ac7c1a03134d1d7f474ce10e5/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java#L242-L248 https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/84fcdd4bc66b020ac7c1a03134d1d7f474ce10e5/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java#L282-L288

Steps to Reproduce

  1. Create a new ClientLib in /apps/<project> with an empty stylesheet
  2. Set allowProxy to {Boolean}true
  3. Add the new ClientLib to your page template
  4. Ensure the versioned-clientlib rewriter exists at /system/console/status-slingrewriter
  5. Observe no hashes been added

Links

https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/2533

kwin commented 3 years ago

There is a comment in https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2577#issuecomment-827499993 which might be helpful. @pcastelog WDYT? Can you come up with a bugfix?

pcastelog commented 3 years ago

Agree with @cshawaus . I think the best option here will be to check if the path starts with "/etc.clientlibs". I will provide a fix asap.

pcastelog commented 3 years ago

2581

kwin commented 3 years ago

This is fixed by #2581