Skip to content

Commit

Permalink
Fix issue with proxied clientlib
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Castelo committed May 3, 2021
1 parent ff750e9 commit f0c11ea
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,16 @@ private HtmlLibrary getLibrary(LibraryType libraryType, String libraryPath, Slin
}

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());
}

private String resolvePathIfProxied(LibraryType libraryType, String libraryPath, ResourceResolver resourceResolver) {
if (!libraryPath.startsWith(PROXY_PREFIX)) {
Resource libraryResource = request.getResourceResolver().resolve(request, libraryPath);
if (libraryResource != null && !(libraryResource instanceof NonExistingResource)) {
return libraryResource.getPath();
}
// Default behavior, to keep consistency with previous implementation and to not return a null path in case
// the resolver can't find the clientlib
return libraryPath;
}
return resolveProxiedClientLibrary(libraryType, libraryPath, resourceResolver, true);
return resolveProxiedClientLibrary(libraryType, libraryPath, request.getResourceResolver(), true);
}

private String resolveProxiedClientLibrary(LibraryType libraryType, String proxiedPath, ResourceResolver resourceResolver, boolean refreshCacheIfNotFound) {
Expand Down

0 comments on commit f0c11ea

Please sign in to comment.