]> granicus.if.org Git - ejabberd/commitdiff
mod_avatar: Reduce log level for too large avatars
authorHolger Weiss <holger@zedat.fu-berlin.de>
Wed, 26 Sep 2018 19:00:52 +0000 (21:00 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Wed, 26 Sep 2018 19:00:52 +0000 (21:00 +0200)
Log a warning rather than an error when publishing an avatar fails due
to its size exceeding the ?MAX_PAYLOAD_SIZE for PubSub items.

src/mod_avatar.erl

index cab74bd8bf718f153d77db7b5df52db0248a4a7a..d5f24e75dd502c7c9f7e3ac1c45306d726981134 100644 (file)
@@ -302,6 +302,10 @@ publish_avatar(#iq{from = JID} = IQ, Meta, MimeType, Data, ItemID) ->
                               [jid:encode(JID), StanzaErr]),
                    {stop, StanzaErr}
            end;
+       {error, #stanza_error{reason = 'not-acceptable'} = StanzaErr} ->
+           ?WARNING_MSG("Failed to publish avatar data for ~s: ~p",
+                        [jid:encode(JID), StanzaErr]),
+           {stop, StanzaErr};
        {error, StanzaErr} ->
            ?ERROR_MSG("Failed to publish avatar data for ~s: ~p",
                       [jid:encode(JID), StanzaErr]),