Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/common.py @ 36676:052351e3e1cd
py3: make os.pardir a bytes
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Mar 2018 12:34:35 -0500 |
parents | f8ea6988a5fb |
children | 6585ac350fd9 |
comparison
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 |