Skip to content

Commit

Permalink
return name of newly created content
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisaCG committed Dec 21, 2023
1 parent 2ad2ea1 commit 128c42a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions jupyter_drives/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ async def post(self, path: str = "", drive: str = ""):
@tornado.web.authenticated
async def patch(self, path: str = "", drive: str = ""):
body = self.get_json_body()
new_file_name = body["new_file_name"]
result = await self._manager.rename_file(new_file_name, drive, path)
result = await self._manager.rename_file(**body, drive, path)
self.finish(json.dump(result))

handlers = [
Expand Down
5 changes: 3 additions & 2 deletions jupyter_drives/managers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async def get_contents(self, drive_name, path = ""):
response["code"] = code
return response

async def new_file(self, type, drive_name, path = ""):
async def new_file(self, drive_name, type = "notebook", path = ""):
'''Create a new file or directory from an S3 drive.
Args:
Expand All @@ -163,8 +163,9 @@ async def new_file(self, type, drive_name, path = ""):
response = {}
try:
if drive_name in self.s3_content_managers:
self.s3_content_managers[drive_name].new_untitled(type)
new_content = self.s3_content_managers[drive_name].new_untitled(type)
code = 201
response["file_name"] = new_content["name"]
else:
code = 404
response["message"] = "Drive doesn't exist or is not mounted."
Expand Down

0 comments on commit 128c42a

Please sign in to comment.