From 4a62d79852c384a2b2f7ef4149616c7acf445ff6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 8 Oct 2025 11:16:32 +0100 Subject: [PATCH] [Fix] Fix set_addr validation to prevent malformed addresses The set_addr function now properly checks that both addr.user and addr.domain are non-empty strings before constructing addr.addr and addr.raw. This prevents creating malformed addresses like '@domain.com' when addr.user is empty, and ensures consistent state when addr.domain is empty. --- src/plugins/lua/aliases.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/aliases.lua b/src/plugins/lua/aliases.lua index ed665c2a48..c65e72962b 100644 --- a/src/plugins/lua/aliases.lua +++ b/src/plugins/lua/aliases.lua @@ -297,8 +297,8 @@ local function set_addr(addr, new_user, new_domain) addr.domain = new_domain end - -- Only update if we have both user and domain - if addr.user and addr.domain and addr.domain ~= '' then + -- Only update if we have both user and domain as non-empty strings + if addr.user and addr.user ~= '' and addr.domain and addr.domain ~= '' then addr.addr = string.format('%s@%s', addr.user, addr.domain) if addr.name and #addr.name > 0 then -- 2.47.3