nfsantos commented on PR #1598:
URL: https://github.com/apache/jackrabbit-oak/pull/1598#issuecomment-2248028267

   > And what about:
   > 
   > ```
   > public static boolean isDirectAncestor(String ancestor, String path) {
   >    int idx = path.lastIndexOf('/');
   >     return ( ancestor.length() == 1 && idx == 0 || idx == 
ancestor.length() ) && isAncestor(ancestor, path);
   > }
   > ```
   
   That works. I updated the PR with the suggested implementation, with a few 
minor cosmetic changes to make it more readable.
   ```
       public static boolean isDirectAncestor(String ancestor, String path) {
           int lastSlashInPath = path.lastIndexOf('/');
           return ((PathUtils.denotesRoot(ancestor) && lastSlashInPath == 0) || 
lastSlashInPath == ancestor.length())
                   && isAncestor(ancestor, path);
       }
   ```
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to