Show More
@@ -180,9 +180,10 b' class FileNotebookManager(NotebookManager):' | |||||
180 | """List the directories for a given API style path.""" |
|
180 | """List the directories for a given API style path.""" | |
181 | path = path.strip('/') |
|
181 | path = path.strip('/') | |
182 | os_path = self._get_os_path('', path) |
|
182 | os_path = self._get_os_path('', path) | |
183 | if is_hidden(os_path, self.notebook_dir): |
|
183 | if not os.path.isdir(os_path): | |
|
184 | raise web.HTTPError(404, u'directory does not exist: %r' % os_path) | |||
|
185 | elif is_hidden(os_path, self.notebook_dir): | |||
184 | self.log.info("Refusing to serve hidden directory, via 404 Error") |
|
186 | self.log.info("Refusing to serve hidden directory, via 404 Error") | |
185 | if not os.path.isdir(os_path) or is_hidden(os_path, self.notebook_dir): |
|
|||
186 | raise web.HTTPError(404, u'directory does not exist: %r' % os_path) |
|
187 | raise web.HTTPError(404, u'directory does not exist: %r' % os_path) | |
187 | dir_names = os.listdir(os_path) |
|
188 | dir_names = os.listdir(os_path) | |
188 | dirs = [] |
|
189 | dirs = [] |
@@ -62,11 +62,12 b' class TreeHandler(IPythonHandler):' | |||||
62 | self.log.debug("Redirecting %s to %s", self.request.path, url) |
|
62 | self.log.debug("Redirecting %s to %s", self.request.path, url) | |
63 | self.redirect(url) |
|
63 | self.redirect(url) | |
64 | else: |
|
64 | else: | |
65 |
if nbm. |
|
65 | if not nbm.path_exists(path=path): | |
66 | self.log.info("Refusing to serve hidden directory, via 404 Error") |
|
|||
67 | if not nbm.path_exists(path=path) or nbm.is_hidden(path): |
|
|||
68 | # Directory is hidden or does not exist. |
|
66 | # Directory is hidden or does not exist. | |
69 | raise web.HTTPError(404) |
|
67 | raise web.HTTPError(404) | |
|
68 | elif nbm.is_hidden(path): | |||
|
69 | self.log.info("Refusing to serve hidden directory, via 404 Error") | |||
|
70 | raise web.HTTPError(404) | |||
70 | breadcrumbs = self.generate_breadcrumbs(path) |
|
71 | breadcrumbs = self.generate_breadcrumbs(path) | |
71 | page_title = self.generate_page_title(path) |
|
72 | page_title = self.generate_page_title(path) | |
72 | self.write(self.render_template('tree.html', |
|
73 | self.write(self.render_template('tree.html', |
General Comments 0
You need to be logged in to leave comments.
Login now