]> granicus.if.org Git - ejabberd/commitdiff
Handle correctly case where ExtraUsername is empty
authorPaweł Chmielowski <pchmielowski@process-one.net>
Thu, 11 Apr 2019 10:00:13 +0000 (12:00 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Thu, 11 Apr 2019 10:00:13 +0000 (12:00 +0200)
src/mod_mam_sql.erl

index 5495fb6e32430eb92b00a0b764caece960172753..386110817e9c8d81ae53bce6f71b45316ebb98ee 100644 (file)
@@ -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,">>,