akankshajain18 commented on a change in pull request #24:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/24#discussion_r528172179



##########
File path: 
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
##########
@@ -1047,13 +1023,39 @@ private boolean addEntry(final Map<String, 
List<MapEntry>> entryMap, final Strin
         return map;
     }
 
-       /**
+    /**
+     *
+     *  validate alias path based on configuration provided
+     */
+
+    protected boolean isValidAliasPath(final String path){
+        if(path == null){
+            throw new IllegalArgumentException("Unexpected null path");
+        }
+
+        // ignore system tree
+        if (path.startsWith(JCR_SYSTEM_PREFIX)){
+            log.debug("loadAliases: Ignoring {}", path);
+            return false;
+        }
+        Set<String> allowedPaths = this.factory.getAllowedAliasPaths();
+        // check allow list
+        if(!allowedPaths.isEmpty()){

Review comment:
       if allowed path is empty then all path will be considered and the method 
should return true
    boolean allowed = allowedPaths.stream().anyMatch(path::startsWith);
   This statement will return false if allowedPaths will be empty
   That's why an empty check is applied explicitly




----------------------------------------------------------------
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]


Reply via email to