fix: improve UUID handling in custom component variables (#5230)
* 🐛 (custom_component.py): fix user_id assignment to convert it to UUID type for consistency and correctness * [autofix.ci] apply automated fixes * 🐛 (custom_component.py): fix potential bug by checking if self.user_id is a string before converting it to UUID --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
3de42f4575
commit
2e7a5cdd67
1 changed files with 3 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import uuid
|
||||
from collections.abc import Callable, Sequence
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, ClassVar
|
||||
|
|
@ -439,7 +440,8 @@ class CustomComponent(BaseComponent):
|
|||
variable_service = get_variable_service() # Get service instance
|
||||
# Retrieve and decrypt the variable by name for the current user
|
||||
async with async_session_scope() as session:
|
||||
user_id = self.user_id or ""
|
||||
if isinstance(self.user_id, str):
|
||||
user_id = uuid.UUID(self.user_id)
|
||||
return await variable_service.get_variable(user_id=user_id, name=name, field=field, session=session)
|
||||
|
||||
async def list_key_names(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue