Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioned ClientLibs no longer works as of 4.12.0 #2568

Closed
cshawaus opened this issue Apr 2, 2021 · 4 comments
Closed

Versioned ClientLibs no longer works as of 4.12.0 #2568

cshawaus opened this issue Apr 2, 2021 · 4 comments
Milestone

Comments

@cshawaus
Copy link

cshawaus commented Apr 2, 2021

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.

String libraryPath = StringUtils.substringBeforeLast(originalPath, ".");
if (libraryPath.endsWith(MIN_SELECTOR_SEGMENT)) {
appendMinSelector = true;
libraryPath = StringUtils.substringBeforeLast(libraryPath, ".");
}
final HtmlLibrary htmlLibrary = getLibrary(libraryType, libraryPath, request);

private String resolvePath(LibraryType libraryType, String libraryPath, SlingHttpServletRequest request) {
Resource libraryResource = request.getResourceResolver().resolve(request, libraryPath);
if (libraryResource != null && !(libraryResource instanceof NonExistingResource)) {
return libraryResource.getPath();
}
return resolvePathIfProxied(libraryType, libraryPath, request.getResourceResolver());
}

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

#2533

@kwin
Copy link
Contributor

kwin commented Apr 27, 2021

There is a comment in #2577 (comment) which might be helpful. @pcastelog WDYT? Can you come up with a bugfix?

@pcastelog
Copy link
Contributor

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
Copy link
Contributor

#2581

@kwin
Copy link
Contributor

kwin commented May 6, 2021

This is fixed by #2581

@kwin kwin closed this as completed May 6, 2021
@kwin kwin modified the milestones: 5.0.4, 5.0.6 May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants