path sanitation now removes ?

This commit is contained in:
Adrian Sampson 2010-07-30 15:27:53 -07:00
parent 2e23c2acc6
commit 6b5edbeead

View file

@ -167,12 +167,12 @@ def _unicode_path(path):
return path.decode(sys.getfilesystemencoding())
# Note: POSIX actually supports \ and : -- I just think they're
# a pain.
# a pain. And ? has caused problems for some.
CHAR_REPLACE = [
(re.compile(r'[\\/]|^\.'), u'_'),
(re.compile(r'[\\/\?]|^\.'), u'_'),
(re.compile(r':'), u'-'),
]
CHAR_REPLACE_WINDOWS = re.compile('["\*\?<>\|]|^\.|\.$'), u'_u'
CHAR_REPLACE_WINDOWS = re.compile('["\*<>\|]|^\.|\.$'), u'_u'
def _sanitize_path(path, plat=None):
"""Takes a path and makes sure that it is legal for the specified
platform (as returned by platform.system()). Returns a new path.