Commit c6ac0606 by rfkelly0

OSFS: don't produce syspaths for things outside the FS

parent 571b9a3e
......@@ -123,6 +123,8 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
def getsyspath(self, path, allow_none=False):
path = relpath(normpath(path)).replace("/",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)
return path
......
......@@ -442,7 +442,6 @@ class FSTestCases(object):
def test_cant_copy_from_os(self):
sys_executable = os.path.abspath(os.path.realpath(sys.executable))
print "COPY", sys_executable
self.assertRaises(FSError,self.fs.copy,sys_executable,"py.exe")
def test_copyfile(self):
......
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