fix: handle already-serialized mount dicts in profile update
When FastAPI parses the request body and model_dump() is called, nested MountItem models are already serialized to plain dicts. The update handler was unconditionally calling model_dump() again, causing AttributeError on dict objects. Fix: Check if mount items are already dicts before calling model_dump(). Fixes: 422 error when updating profiles with mounts.
This commit is contained in:
@@ -429,7 +429,7 @@ async def update_config_profile(
|
||||
if field_name in ("project_id", "tool_type_id"):
|
||||
value = uuid.UUID(value) if value else None
|
||||
elif field_name == "mounts" and value is not None:
|
||||
value = [m.model_dump() for m in value]
|
||||
value = [m.model_dump() if not isinstance(m, dict) else m for m in value]
|
||||
setattr(profile, field_name, value)
|
||||
|
||||
await session.commit()
|
||||
|
||||
Reference in New Issue
Block a user