[FIX] tools: verify path before opening
This commit is contained in:
parent
d0301459ae
commit
d18d606a55
|
@ -205,7 +205,16 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False):
|
|||
|
||||
|
||||
def _fileopen(path, mode, basedir, pathinfo, basename=None):
|
||||
name = os.path.normpath(os.path.join(basedir, path))
|
||||
name = os.path.normpath(os.path.normcase(os.path.join(basedir, path)))
|
||||
|
||||
import openerp.modules as addons
|
||||
paths = addons.module.ad_paths + [config['root_path']]
|
||||
for addons_path in paths:
|
||||
addons_path = os.path.normpath(os.path.normcase(addons_path)) + os.sep
|
||||
if name.startswith(addons_path):
|
||||
break
|
||||
else:
|
||||
raise ValueError("Unknown path: %s" % name)
|
||||
|
||||
if basename is None:
|
||||
basename = name
|
||||
|
|
Loading…
Reference in New Issue