akankshajain18 commented on a change in pull request #24:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/24#discussion_r545787912
##########
File path:
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
##########
@@ -306,27 +307,29 @@ protected void activate(final BundleContext
bundleContext, final ResourceResolve
}
// optimize alias path allow list
- this.aliasPathAllowList.clear();
String[] aliasPathPrefix =
config.resource_resolver_allowed_alias_locations();
if ( aliasPathPrefix != null ) {
+ final Set<String> prefixSet = new TreeSet<>();
for(final String prefix : aliasPathPrefix) {
String value = prefix.trim();
- if (!value.isEmpty()&&value.startsWith("/")) { // absolute
path should be given
- if (value.endsWith("/")) {
- this.aliasPathAllowList.add(value);
- } else {
- this.aliasPathAllowList.add(value + "/");
- }
+ if (!value.isEmpty()) {
+ if ( value.endsWith("/") ) {
+ prefixSet.add(value);
+ } else {
+ prefixSet.add(value + "/");
}
+ }
+ }
+ if ( !prefixSet.isEmpty()) {
+ this.aliasPathAllowList =
Collections.unmodifiableSet(prefixSet);
}
- Collections.sort(this.aliasPathAllowList);
}
// vanity path white list
this.vanityPathWhiteList = null;
String[] vanityPathPrefixes =
config.resource_resolver_vanitypath_whitelist();
if ( vanityPathPrefixes != null ) {
- final List<String> prefixList = new ArrayList<>();
+ List<String> prefixList = new ArrayList<>();
Review comment:
yes, it is not in the scope of PR.
updated changes
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]