Fixed a potential IndexError if variable 'dir' equals ''

bzr revid: olt@tinyerp.com-20090114075902-tz5sbtlkcsrg56qc
This commit is contained in:
Olivier Laurent 2009-01-14 08:59:02 +01:00
parent 121bbced1e
commit 892eeea5ae
1 changed files with 3 additions and 2 deletions

View File

@ -154,8 +154,9 @@ def get_module_filetree(module, dir='.'):
return False
dir = os.path.normpath(dir)
if dir == '.': dir = ''
if dir.startswith('..') or dir[0] == '/':
if dir == '.':
dir = ''
if dir.startswith('..') or (dir and dir[0] == '/'):
raise Exception('Cannot access file outside the module')
if not os.path.isdir(path):