fix(tinode): trim tenant code before login_type comparison

Code review of the login_type fix (11276804) found tenantCode.toLowerCase()
=== 'default' doesn't trim, so a tenant code with stray leading/trailing
whitespace would be misclassified as enterprise (login_type:0) instead of
personal (login_type:1). tenant.code always comes from the resolve
response, not raw user input, so this was a latent edge case rather than
a reproduced bug -- hardened anyway since the fix is free, matching the
.trim() already used on tenant code elsewhere in this codebase.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-09-22 14:42:39 +08:00
co-authored by Claude Sonnet 5
parent 1127680425
commit 370bf9d5b0
+1 -1
View File
@@ -173,7 +173,7 @@ function installOutgoingPacketPatches(t: Tinode) {
const parsed = JSON.parse(msg);
if (parsed.login && parsed.login.scheme === 'basic') {
const tenantCode = useSessionStore.getState().tenant?.code || 'default';
parsed.login.login_type = tenantCode.toLowerCase() === 'default' ? 1 : 0;
parsed.login.login_type = tenantCode.trim().toLowerCase() === 'default' ? 1 : 0;
msg = JSON.stringify(parsed);
}
} catch {