Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions server/mergin/sync/public_api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,23 +580,19 @@ def get_projects_by_names(): # noqa: E501

# batch-resolve workspaces by name (one DB query for DB-backed handlers)
unique_ws_names = {
key.split("/")[0].lower()
for key in list_of_projects
if len(key.split("/")) == 2
key.split("/")[0] for key in list_of_projects if len(key.split("/")) == 2
}
workspaces_by_name = {
ws.name.lower(): ws
for ws in current_app.ws_handler.get_by_names(unique_ws_names)
ws.name: ws for ws in current_app.ws_handler.get_by_names(unique_ws_names)
}

results = {}
valid_projects = [] # list of (key, workspace, project_name)
for key in list_of_projects:
parts = key.split("/")
if len(parts) != 2:
results[key] = {"error": 404}
continue
workspace = workspaces_by_name.get(parts[0].lower())
workspace = workspaces_by_name.get(parts[0])
if not workspace:
results[key] = {"error": 404}
continue
Expand Down
Loading