Skip to content

Commit a8bf3f6

Browse files
Fix bug in api/contents requests for an allowed copy (#939)
1 parent 54164ac commit a8bf3f6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

jupyter_server/services/contents/handlers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ async def post(self, path=""):
218218
raise web.HTTPError(400, f"Cannot copy file or directory {path!r}")
219219
else:
220220
await self._copy(copy_from, path)
221-
222-
ext = model.get("ext", "")
223-
type = model.get("type", "")
224-
if type not in {None, "", "directory", "file", "notebook"}:
225-
# fall back to file if unknown type
226-
type = "file"
227-
await self._new_untitled(path, type=type, ext=ext)
221+
else:
222+
ext = model.get("ext", "")
223+
type = model.get("type", "")
224+
if type not in {None, "", "directory", "file", "notebook"}:
225+
# fall back to file if unknown type
226+
type = "file"
227+
await self._new_untitled(path, type=type, ext=ext)
228228
else:
229229
await self._new_untitled(path)
230230

0 commit comments

Comments
 (0)