Skip to content

Commit e59610b

Browse files
Allow new file types (#895)
1 parent 3090893 commit e59610b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jupyter_server/services/contents/handlers.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ async def get(self, path=""):
9999

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

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

0 commit comments

Comments
 (0)