mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Handle if user subscription field doesn't exists in telemetry func
Avoid null ref in the method when running Khoj server in anon mode
This commit is contained in:
parent
110d7646fc
commit
643e018947
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ def update_telemetry_state(
|
|||
metadata: Optional[dict] = None,
|
||||
):
|
||||
user: KhojUser = request.user.object if request.user.is_authenticated else None
|
||||
subscription: Subscription = user.subscription if user and user.subscription else None
|
||||
subscription: Subscription = user.subscription if user and hasattr(user, "subscription") else None
|
||||
user_state = {
|
||||
"client_host": request.client.host if request.client else None,
|
||||
"user_agent": user_agent or "unknown",
|
||||
|
|
Loading…
Reference in a new issue