Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25318

Notification emails don't use the default avatar and logo when the image format is not supported

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 9.10-rc-1
    • Notifications
    • None
    • Unknown

    Description

      Notification emails embed the avatar of each user involved in the events and the wiki logo, as inline attachments.

      User avatars

      The avatar is read with Java ImageIO to be cropped and resized to a small JPEG (UserAvatarAttachmentExtractor). When there is no ImageIO reader for the format of the avatar (SVG, WebP, AVIF, JPEG XL, ...) ImageIO.read returns null and a NullPointerException is thrown. As a consequence:

      • a warning with a full stack trace ("Failed to add the avatar of [...] in the email") is logged for each such user, in each notification email;
      • the avatar of the user is missing from the email, instead of being replaced by the default avatar, which is what is already done for users who don't have an avatar.

      Steps to reproduce: set as avatar of a user a WebP image (e.g. a WebP image saved from a website with a .jpg or .png name, or an .svg / .webp attachment selected from the object editor), then make this user modify a page watched by another user who receives email notifications.

      Expected: the default avatar is used (with at most a short log message, without stack trace).

      Wiki logo

      The logo of the color theme or of the skin is embedded as is, except when its name ends with .svg (LogoAttachmentExtractor). This check is case-sensitive (a Logo.SVG file is embedded) and lets through any other format, while most mail clients only reliably display PNG, JPEG and GIF images.

      Expected: only embed a color theme or skin logo whose media type is image/png, image/jpeg or image/gif, and otherwise fall back to the next logo (skin logo, then the default logo.png), like it is already done for SVG logos (see XWIKI-18299). Note that BMP, ICO or TIFF logos would then not be embedded anymore, which is fine since most mail clients cannot display them anyway.

      This becomes more likely to happen once WebP, AVIF and JPEG XL images can be selected as avatars and logos (XWIKI-25320).

      Attachments

        Issue Links

          Activity

            People

              ciaens Clément Christiaens
              ciaens Clément Christiaens
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: