diff options
author | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-11-28 18:32:58 +0000 |
---|---|---|
committer | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-11-28 18:32:58 +0000 |
commit | 1c1b19de9deb7b42ec35f172b72d5a728759768f (patch) | |
tree | b6e36ff19bd10f0a5ee9f7c1c71381999278d643 /fs/osfs | |
parent | 28900b32efe858b50b7f2191260d43b2e6a7766d (diff) | |
download | pyfilesystem-git-1c1b19de9deb7b42ec35f172b72d5a728759768f.tar.gz |
Fix for invalid chars in path on win32
Diffstat (limited to 'fs/osfs')
-rw-r--r-- | fs/osfs/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/osfs/__init__.py b/fs/osfs/__init__.py index a6f0a3a..4202784 100644 --- a/fs/osfs/__init__.py +++ b/fs/osfs/__init__.py @@ -88,7 +88,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS): } if sys.platform == 'win32': - _invalid_path_chars = '\\:*?"<>|' + _invalid_path_chars = ''.join(char(n) for n in xrange(31)) + '\\:*?"<>|' else: _invalid_path_chars = '\0' _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): raise InvalidCharsInPathError(path) 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) if not path.startswith(self.root_path): raise PathError(path, msg="OSFS given path outside root: %(path)s") path = self._decode_path(path) - self._validate_path(path) return path def unsyspath(self, path): |