From 95a53b775e24aaaef9ae0f74d34feea13acd6c72 Mon Sep 17 00:00:00 2001 From: Anastasis Germanidis Date: Wed, 19 Jul 2017 10:10:19 -0400 Subject: [PATCH] Fixed bug in get_content_type --- notebook/base/handlers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py index 7e21878b6..68006e8c5 100755 --- a/notebook/base/handlers.py +++ b/notebook/base/handlers.py @@ -479,7 +479,11 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler): return web.StaticFileHandler.get(self, path) def get_content_type(self): - _, name = self.absolute_path.rsplit('/', 1) + path = self.absolute_path.strip('/') + if '/' in path: + _, name = path.rsplit('/', 1) + else: + name = path if name.endswith('.ipynb'): return 'application/x-ipynb+json' else: