Skip to content

Commit

Permalink
Allow new file types (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart authored Jul 26, 2022
1 parent 3090893 commit e59610b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jupyter_server/services/contents/handlers.py
Original file line number Diff line number Diff line change
@@ -99,7 +99,8 @@ async def get(self, path=""):

type = self.get_query_argument("type", default=None)
if type not in {None, "directory", "file", "notebook"}:
raise web.HTTPError(400, "Type %r is invalid" % type)
# fall back to file if unknown type
type = "file"

format = self.get_query_argument("format", default=None)
if format not in {None, "text", "base64"}:
@@ -222,6 +223,9 @@ async def post(self, path=""):
copy_from = model.get("copy_from")
ext = model.get("ext", "")
type = model.get("type", "")
if type not in {None, "", "directory", "file", "notebook"}:
# fall back to file if unknown type
type = "file"
if copy_from:
await self._copy(copy_from, path)
else:

0 comments on commit e59610b

Please sign in to comment.