mercurial/hgweb/common.py
changeset 36648 6585ac350fd9
parent 36647 052351e3e1cd
child 36781 ffa3026d4196
equal deleted inserted replaced
36647:052351e3e1cd 36648:6585ac350fd9
   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, pycompat.ospardir) or
   141         if (part in ('', pycompat.oscurdir, 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