From 2009d375bc4d383c66175f2c4c696083335dbe6a Mon Sep 17 00:00:00 2001 From: Amadeus Demarzi Date: Fri, 2 Nov 2012 18:28:36 -0700 Subject: [PATCH] Fixed sub directory navigation in weltmeister --- server.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index 1b42917..e70aa42 100644 --- a/server.py +++ b/server.py @@ -128,13 +128,16 @@ def save(self): def browse(self): # Get the directory to scan - dir = self.query_params['dir'][0] if 'dir' in self.query_params else '.' - dir = dir.replace('..', '') - if dir[-1] != '/': - dir += '/' + dir = '' + if 'dir' in self.query_params: + dir = self.query_params['dir'][0].replace('..', '') + if dir[-1] != '/': + dir += '/' # Get the dir and files - dirs = [d for d in os.listdir(os.path.join(BASE_DIR, dir)) if '.' not in d] + dirs = [os.path.join(dir, d) for d in os.listdir(os.path.join(BASE_DIR, dir)) + if os.path.isdir(os.path.join(dir, d))] + files = glob.glob(dir + '*.*') # Filter on file types