Skip to content

fix(theming): render touch icon and favicon from the uploaded favicon - #66822

Open
jiri001meitner wants to merge 1 commit into
nextcloud:masterfrom
jiri001meitner:fix/theming-favicon-mime
Open

jiri001meitner wants to merge 1 commit into
nextcloud:masterfrom
jiri001meitner:fix/theming-favicon-mime

Conversation

@jiri001meitner

@jiri001meitner jiri001meitner commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

An uploaded favicon was served by the touch icon endpoint as is, so an SVG favicon was sent as application/octet-stream. Browsers did not display it, the web app manifest icon failed, and Chrome did not offer to install Nextcloud. The favicon itself was rasterized from the SVG at its intrinsic size (often 16 or 24 px), and the manifest declared types and sizes that did not match what was served.

Touch icon (/apps/theming/icon, used as apple-touch-icon):

  • rendered as PNG from the uploaded favicon: an SVG at 512 px, a raster image at its own size (at most 512 px), never enlarged
  • a square favicon with opaque edges (already designed as a tile) fills the icon, its rounded corners get the edge color; other favicons are placed with padding on the primary color, like the app icons, because iOS fills transparent areas with black
  • the generated touch icon is used if the result would be smaller than 144 px (the minimum for installable web apps in Chrome), if the favicon cannot be rendered or if the rendering is fully transparent; failed renderings are cached
  • of an ICO file or an animation, the largest image is used

Favicon (/apps/theming/favicon):

  • an SVG favicon is sent as SVG, browsers render it more reliably than ImageMagick's internal SVG renderer
  • a raster favicon is converted to a square ICO file with 16 to 128 px images, without upscaling; an uploaded ICO file is kept

Web app manifest:

  • an SVG favicon is listed first as SVG (sizes: any), followed by a transparent 512 px PNG image for browsers without SVG icons; Chrome on desktop installs the app with the SVG icon and does not fetch the PNG image
  • a raster favicon is listed as a transparent PNG image at its own size (at most 512 px), without resampling
  • the PNG image is served by the new endpoint /apps/theming/manifest-icon
  • the touch icon is listed instead if the favicon cannot be rendered or a raster favicon is smaller than 144 px
  • the types and sizes match the served images; the favicon is no longer listed as a 16 px SVG image
  • without Imagick, an SVG favicon is listed as SVG and a raster favicon as it is with its MIME type and size

Before and after

How to verify:

  1. Upload an SVG favicon in Administration settings → Theming.
  2. curl -sI on /apps/theming/favicon, /apps/theming/icon and /apps/theming/manifest-icon: image/svg+xml, image/png, image/png (before: image/x-icon and application/octet-stream).
  3. /apps/theming/manifest/core lists the SVG icon (sizes: any) and the 512 px PNG icon; Chrome offers to install Nextcloud.
  4. Repeat with a PNG favicon (e.g. 180 px): no image is enlarged, the manifest lists a 180x180 PNG icon.

Not covered here:

TODO

  • None

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The code, tests and this description were drafted with Claude Code (claude-opus-5-5), which also tested the change on live instances in Chrome and Firefox.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

An uploaded favicon was served as it is, so the touch icon of an SVG
favicon was sent as application/octet-stream and browsers rejected it.
The favicon was rasterized at the intrinsic size of the SVG image, and
the web app manifest declared types and sizes that did not match.

- The touch icon is rendered from the uploaded favicon. A square
  favicon with opaque edges, already designed as a tile, fills the
  icon and its rounded corners get the edge color. Other favicons are
  rendered like the app icons on the primary color, as iOS fills
  transparency with black.
- An SVG favicon is rendered at 512 px. A raster favicon is not
  enlarged, the icon is at most 512 px. If the icon would be smaller
  than the 144 px required for installable web apps, the generated
  touch icon is used, as when the favicon cannot be rendered.
- The web app manifest uses the uploaded favicon without a background,
  as only iOS fills transparency and it uses the touch icon. An SVG
  favicon is listed as SVG first, followed by a PNG image for browsers
  without SVG icons, served by the new manifest-icon endpoint. A raster
  favicon is listed as this PNG image only, at its own size up to
  512 px. The touch icon is listed if the favicon cannot be used.
- An SVG favicon is sent as SVG, browsers render it more reliably than
  ImageMagick. A raster favicon is converted to a square ICO file with
  16 to 128 px images without upscaling, an uploaded ICO file is kept.
- The largest image of an ICO file or an animation is used. A fully
  transparent rendering counts as failed, and failed renderings are
  cached.
- Without Imagick, the uploaded favicon is sent with its MIME type.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Jiří Meitner <1045987+jiri001meitner@users.noreply.github.com>
@jiri001meitner
jiri001meitner force-pushed the fix/theming-favicon-mime branch from 1793eb9 to ec99679 Compare December 6, 2026 00:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: F-33 An uploaded SVG favicon is served as application/octet-stream, the web app manifest icon fails

1 participant