diff --git a/jupyter_server/files/handlers.py b/jupyter_server/files/handlers.py index 2eab425aeb..cf989f0a17 100644 --- a/jupyter_server/files/handlers.py +++ b/jupyter_server/files/handlers.py @@ -11,7 +11,6 @@ from jupyter_server.base.handlers import JupyterHandler from jupyter_server.utils import ensure_async - AUTH_RESOURCE = "contents" @@ -65,9 +64,14 @@ async def get(self, path, include_body=True): if name.lower().endswith(".ipynb"): self.set_header("Content-Type", "application/x-ipynb+json") else: - cur_mime = mimetypes.guess_type(name)[0] + cur_mime, encoding = mimetypes.guess_type(name) if cur_mime == "text/plain": self.set_header("Content-Type", "text/plain; charset=UTF-8") + # RFC 6713 + if encoding == "gzip": + return "application/gzip" + elif encoding is not None: + return "application/octet-stream" elif cur_mime is not None: self.set_header("Content-Type", cur_mime) else: diff --git a/jupyter_server/terminal/terminalmanager.py b/jupyter_server/terminal/terminalmanager.py index 1db545e4a4..4371608d88 100644 --- a/jupyter_server/terminal/terminalmanager.py +++ b/jupyter_server/terminal/terminalmanager.py @@ -167,3 +167,6 @@ async def _cull_inactive_terminal(self, name): inactivity, ) await self.terminate(name, force=True) + + def pre_pty_read_hook(self, ptywclients): + ptywclients.last_activity = utcnow()