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, including formats that are poorly supported by mail clients (TIFF, AVIF/HEIF, JPEG XL), see e.g. https://www.caniemail.com.

      Expected: only embed a color theme or skin logo whose media type is in a list of supported media types, 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). The list is configurable in xwiki.properties (notifications.emails.logo.supportedMediaTypes) and defaults to image/png, image/jpeg, image/gif, image/bmp, image/x-icon, image/vnd.microsoft.icon and image/webp, so that only SVG, TIFF, AVIF/HEIF and JPEG XL logos stop being embedded by default. Administrators whose recipients mostly use classic Outlook for Windows can remove image/webp.

      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: