Skip to content

SVG-logo not displaying in emails due to wrong useSvg flag in html src-code #25984

@woutergrimme

Description

@woutergrimme

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Using the 'Theming' settings in the admin-panel, upload a SVG-based logo. (e.g. logo.svg)
  2. Do something to get an email from the server (e.g. login from an unknown location, have someone else share a file with you, etc.)
  3. Check your email client for the mail (I do it using RoundCube, but doesn't matter) -> the logo does not show in the email.
  4. Go to developer view in your browser, and in the following part of the code that loads the logo, change useSvg=0 to useSvg=1:
    src="https://www.yourdomain.tld/apps/theming/image/logo?useSvg=0&v=11"
  5. Now the logo shows

Now I can change this code in developer view of a browser easily, but this needs off course be done on the server side. I'm guessing there is a part of the server-code that handles the emails that doesn't properly check the extension of the logo-files used and/or sets the wrong flag.
If someone can point me in the right direction on how to fix it, I can try to fix it and make my first contribution to Nextcloud :) Thanks!

Edit:
My first guess would be that the problem arises from the following code:
$logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo(false));
in the file server/lib/private/Mail/EMailTemplate.php

To me it seems (but I do not fully understand the workings of the code), that the problem is getLogo(false) instead of getLogo().
Why does it state false? Compatibility with older email systems that do not support svg?

Server configuration

Operating system:
Ubuntu 20.04 LTS

Web server:
Apache

Database:
MariaDB 10.3

PHP version:
7.4

Nextcloud version: (see Nextcloud admin page)
20.0.7.1 (but has been the case since version 15 or so)

Updated from an older Nextcloud/ownCloud or fresh install:
Updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbugneeds infostaleTicket or PR with no recent activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions