It's missing an isLeaf() check before trying to visit the file.
But I agree, there's no point invoking isLeaf() twice (once by the caller
and once by the backed) when it could just return an empty list.
For now I have added the isLeaf check as making the change would break some of the unit tests in the vfs project and wanted to be sure this is a behavior change we want to make. I have created a jira issue to change this behavior.