From 1ab303ca60a097ae944e4e85a77ef007e7fafa51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=9A=D1=80=D0=B8=D0=B2?= =?UTF-8?q?=D0=BE=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Thu, 30 Jul 2026 14:12:11 +0700 Subject: [PATCH] fix: set raw_mail to None when AD mail is empty [] instead of string --- instruct/handlers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instruct/handlers.py b/instruct/handlers.py index f6ba062..384574b 100644 --- a/instruct/handlers.py +++ b/instruct/handlers.py @@ -149,7 +149,9 @@ def get_ad_user_info(user_id: str) -> dict | None: entry = entries[0] cn = str(entry.cn) raw_mail = str(entry.mail) if 'mail' in entry else "" - mail = raw_mail if raw_mail and raw_mail not in ("[]", "N/A", "") else None + if raw_mail in ("[]", "N/A", ""): + raw_mail = None + mail = raw_mail if raw_mail else None if not mail: raw_upn = str(entry.userPrincipalName) if 'userPrincipalName' in entry else "" if raw_upn and raw_upn not in ("[]", "N/A", ""):