path: extract the path validation logic into its own submethod...
path: extract the path validation logic into its own submethod
We will need to re-use this logic for `path://` so we first extract it into its own method.
Differential Revision:
https://phab.mercurial-scm.org/D10261