Skip to content

Commit

Permalink
Fix workspace check
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Aug 18, 2024
1 parent 40a76f7 commit 59e238b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hypha/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,12 @@ async def create_workspace(
user_info = UserInfo.model_validate(context["user"])
if user_info.is_anonymous:
raise Exception("Only registered user can create workspace.")
if await self._redis.hexists("workspace", config["name"]):
if not overwrite:
raise KeyError(f"Workspace already exists: {ws}")
try:
if await self.load_workspace_info(ws):
if not overwrite:
raise KeyError(f"Workspace already exists: {ws}")
except KeyError:
pass

config["persistent"] = config.get("persistent") or False
if user_info.is_anonymous and config["persistent"]:
Expand Down

0 comments on commit 59e238b

Please sign in to comment.