From: Paweł Chmielowski Date: Thu, 11 Apr 2019 10:00:13 +0000 (+0200) Subject: Handle correctly case where ExtraUsername is empty X-Git-Tag: 19.05~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8761e6e0e044911dbe42295cee3d3f288b346b06;p=ejabberd Handle correctly case where ExtraUsername is empty --- diff --git a/src/mod_mam_sql.erl b/src/mod_mam_sql.erl index 5495fb6e3..386110817 100644 --- a/src/mod_mam_sql.erl +++ b/src/mod_mam_sql.erl @@ -420,9 +420,9 @@ make_sql_query(User, LServer, MAMQuery, RSM, ExtraUsernames) -> {UserSel, UserWhere} = case ExtraUsernames of Users when is_list(Users) -> - EscUsers = [<<"'", (Escape(U))/binary, "'">> || U <- Users], + EscUsers = [<<"'", (Escape(U))/binary, "'">> || U <- [SUser | Users]], {<<" username,">>, - [<<" username in ('">>, SUser, <<"',">>, str:join(EscUsers, <<",">>), <<")">>]}; + [<<" username in (">>, str:join(EscUsers, <<",">>), <<")">>]}; subscribers_table -> SJid = jid:encode({User, LServer, <<>>}), {<<" username,">>,