Fixed checks with os.path.realpath() for systems with symlinked paths
This commit is contained in:
parent
d3abeed3a9
commit
b7c9949caf
2 changed files with 2 additions and 2 deletions
|
|
@ -1072,7 +1072,7 @@ class Settings(object):
|
||||||
def saveScript(self, script_type, name, script):
|
def saveScript(self, script_type, name, script):
|
||||||
script_folder = self.getBaseFolder("scripts")
|
script_folder = self.getBaseFolder("scripts")
|
||||||
filename = os.path.realpath(os.path.join(script_folder, script_type, name))
|
filename = os.path.realpath(os.path.join(script_folder, script_type, name))
|
||||||
if not filename.startswith(script_folder):
|
if not filename.startswith(os.path.realpath(script_folder)):
|
||||||
# oops, jail break, that shouldn't happen
|
# oops, jail break, that shouldn't happen
|
||||||
raise ValueError("Invalid script path to save to: {filename} (from {script_type}:{name})".format(**locals()))
|
raise ValueError("Invalid script path to save to: {filename} (from {script_type}:{name})".format(**locals()))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ class SlicingManager(object):
|
||||||
name = self._sanitize(name)
|
name = self._sanitize(name)
|
||||||
|
|
||||||
path = os.path.join(self.get_slicer_profile_path(slicer), "{name}.profile".format(name=name))
|
path = os.path.join(self.get_slicer_profile_path(slicer), "{name}.profile".format(name=name))
|
||||||
if not os.path.realpath(path).startswith(self._profile_path):
|
if not os.path.realpath(path).startswith(os.path.realpath(self._profile_path)):
|
||||||
raise IOError("Path to profile {name} tried to break out of allows sub path".format(**locals()))
|
raise IOError("Path to profile {name} tried to break out of allows sub path".format(**locals()))
|
||||||
if must_exist and not (os.path.exists(path) and os.path.isfile(path)):
|
if must_exist and not (os.path.exists(path) and os.path.isfile(path)):
|
||||||
raise UnknownProfile(slicer, name)
|
raise UnknownProfile(slicer, name)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue