##// END OF EJS Templates
log refusal to serve hidden files dirs
Paul Ivanov -
Show More
@@ -263,6 +263,7 b' class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):'
263 abs_path = super(AuthenticatedFileHandler, self).validate_absolute_path(root, absolute_path)
263 abs_path = super(AuthenticatedFileHandler, self).validate_absolute_path(root, absolute_path)
264 abs_root = os.path.abspath(root)
264 abs_root = os.path.abspath(root)
265 if is_hidden(abs_path, abs_root):
265 if is_hidden(abs_path, abs_root):
266 self.log.info("Refusing to serve hidden file, via 404 Error")
266 raise web.HTTPError(404)
267 raise web.HTTPError(404)
267 return abs_path
268 return abs_path
268
269
@@ -180,6 +180,8 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):
184 self.log.info("Refusing to serve hidden directory, via 404 Error")
183 if not os.path.isdir(os_path) or is_hidden(os_path, self.notebook_dir):
185 if not os.path.isdir(os_path) or is_hidden(os_path, self.notebook_dir):
184 raise web.HTTPError(404, u'directory does not exist: %r' % os_path)
186 raise web.HTTPError(404, u'directory does not exist: %r' % os_path)
185 dir_names = os.listdir(os_path)
187 dir_names = os.listdir(os_path)
@@ -62,6 +62,8 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.is_hidden(path):
66 self.log.info("Refusing to serve hidden directory, via 404 Error")
65 if not nbm.path_exists(path=path) or nbm.is_hidden(path):
67 if not nbm.path_exists(path=path) or nbm.is_hidden(path):
66 # Directory is hidden or does not exist.
68 # Directory is hidden or does not exist.
67 raise web.HTTPError(404)
69 raise web.HTTPError(404)
General Comments 0
You need to be logged in to leave comments. Login now