Browse files

Fixed sub directory navigation in weltmeister

  • Loading branch information...
1 parent 4593b80 commit 2009d375bc4d383c66175f2c4c696083335dbe6a @amadeus committed Nov 2, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 server.py
View
13 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

0 comments on commit 2009d37

Please sign in to comment.