mercurial/hgweb/common.py
changeset 36676 052351e3e1cd
parent 36459 f8ea6988a5fb
child 36677 6585ac350fd9
equal deleted inserted replaced
36675:463df2986814 36676:052351e3e1cd
   136 
   136 
   137 def ispathsafe(path):
   137 def ispathsafe(path):
   138     """Determine if a path is safe to use for filesystem access."""
   138     """Determine if a path is safe to use for filesystem access."""
   139     parts = path.split('/')
   139     parts = path.split('/')
   140     for part in parts:
   140     for part in parts:
   141         if (part in ('', os.curdir, os.pardir) or
   141         if (part in ('', os.curdir, pycompat.ospardir) or
   142             pycompat.ossep in part or
   142             pycompat.ossep in part or
   143             pycompat.osaltsep is not None and pycompat.osaltsep in part):
   143             pycompat.osaltsep is not None and pycompat.osaltsep in part):
   144             return False
   144             return False
   145 
   145 
   146     return True
   146     return True