Merge pull request #18452 from kaiwinut/fix/chat-getattr-error
fix: Handle invalid order_by attribute in Chat
This commit is contained in:
@@ -441,7 +441,7 @@ class ChatTable:
|
|||||||
direction = filter.get("direction")
|
direction = filter.get("direction")
|
||||||
|
|
||||||
if order_by and direction:
|
if order_by and direction:
|
||||||
if not getattr(Chat, order_by):
|
if not getattr(Chat, order_by, None):
|
||||||
raise ValueError("Invalid order_by field")
|
raise ValueError("Invalid order_by field")
|
||||||
|
|
||||||
if direction.lower() == "asc":
|
if direction.lower() == "asc":
|
||||||
|
|||||||
Reference in New Issue
Block a user