Commit 1c1b19de by willmcgugan@gmail.com

Fix for invalid chars in path on win32

parent 28900b32
...@@ -88,7 +88,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS): ...@@ -88,7 +88,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
} }
if sys.platform == 'win32': if sys.platform == 'win32':
_invalid_path_chars = '\\:*?"<>|' _invalid_path_chars = ''.join(char(n) for n in xrange(31)) + '\\:*?"<>|'
else: else:
_invalid_path_chars = '\0' _invalid_path_chars = '\0'
_re_invalid_path_chars = re.compile('|'.join(re.escape(c) for c in _invalid_path_chars), re.UNICODE) _re_invalid_path_chars = re.compile('|'.join(re.escape(c) for c in _invalid_path_chars), re.UNICODE)
...@@ -159,12 +159,12 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS): ...@@ -159,12 +159,12 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
raise InvalidCharsInPathError(path) raise InvalidCharsInPathError(path)
def getsyspath(self, path, allow_none=False): def getsyspath(self, path, allow_none=False):
path = relpath(normpath(path)).replace("/", os.sep) self._validate_path(path)
path = relpath(normpath(path)).replace(u"/", os.sep)
path = os.path.join(self.root_path, path) path = os.path.join(self.root_path, path)
if not path.startswith(self.root_path): if not path.startswith(self.root_path):
raise PathError(path, msg="OSFS given path outside root: %(path)s") raise PathError(path, msg="OSFS given path outside root: %(path)s")
path = self._decode_path(path) path = self._decode_path(path)
self._validate_path(path)
return path return path
def unsyspath(self, path): def unsyspath(self, path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment