Show More
@@ -138,7 +138,7 b' 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, |
|
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 |
@@ -65,7 +65,7 b' class pathauditor(object):' | |||||
65 | parts = util.splitpath(path) |
|
65 | parts = util.splitpath(path) | |
66 | if (os.path.splitdrive(path)[0] |
|
66 | if (os.path.splitdrive(path)[0] | |
67 | or _lowerclean(parts[0]) in ('.hg', '.hg.', '') |
|
67 | or _lowerclean(parts[0]) in ('.hg', '.hg.', '') | |
68 |
or |
|
68 | or pycompat.ospardir in parts): | |
69 | raise error.Abort(_("path contains illegal component: %s") % path) |
|
69 | raise error.Abort(_("path contains illegal component: %s") % path) | |
70 | # Windows shortname aliases |
|
70 | # Windows shortname aliases | |
71 | for p in parts: |
|
71 | for p in parts: |
@@ -51,6 +51,7 b' if ispy3:' | |||||
51 | oslinesep = os.linesep.encode('ascii') |
|
51 | oslinesep = os.linesep.encode('ascii') | |
52 | osname = os.name.encode('ascii') |
|
52 | osname = os.name.encode('ascii') | |
53 | ospathsep = os.pathsep.encode('ascii') |
|
53 | ospathsep = os.pathsep.encode('ascii') | |
|
54 | ospardir = os.pardir.encode('ascii') | |||
54 | ossep = os.sep.encode('ascii') |
|
55 | ossep = os.sep.encode('ascii') | |
55 | osaltsep = os.altsep |
|
56 | osaltsep = os.altsep | |
56 | if osaltsep: |
|
57 | if osaltsep: | |
@@ -323,6 +324,7 b' else:' | |||||
323 | oslinesep = os.linesep |
|
324 | oslinesep = os.linesep | |
324 | osname = os.name |
|
325 | osname = os.name | |
325 | ospathsep = os.pathsep |
|
326 | ospathsep = os.pathsep | |
|
327 | ospardir = os.pardir | |||
326 | ossep = os.sep |
|
328 | ossep = os.sep | |
327 | osaltsep = os.altsep |
|
329 | osaltsep = os.altsep | |
328 | stdin = sys.stdin |
|
330 | stdin = sys.stdin |
@@ -1600,7 +1600,7 b' def stylemap(styles, paths=None):' | |||||
1600 | for style in styles: |
|
1600 | for style in styles: | |
1601 | # only plain name is allowed to honor template paths |
|
1601 | # only plain name is allowed to honor template paths | |
1602 | if (not style |
|
1602 | if (not style | |
1603 |
or style in (os.curdir, |
|
1603 | or style in (os.curdir, pycompat.ospardir) | |
1604 | or pycompat.ossep in style |
|
1604 | or pycompat.ossep in style | |
1605 | or pycompat.osaltsep and pycompat.osaltsep in style): |
|
1605 | or pycompat.osaltsep and pycompat.osaltsep in style): | |
1606 | continue |
|
1606 | continue |
General Comments 0
You need to be logged in to leave comments.
Login now