Skip to content

fix(theming): fix broken custom images introduced by #58224#60198

Open
miaulalala wants to merge 3 commits intomasterfrom
fix/noid/theming-broken-images-32-0-9
Open

fix(theming): fix broken custom images introduced by #58224#60198
miaulalala wants to merge 3 commits intomasterfrom
fix/noid/theming-broken-images-32-0-9

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

Summary

Fixes #60146 — custom theming images (logo, background, favicon, header logo) broken since 32.0.9.

Three bugs were introduced by the backport of #55132 (PR #58224):

  • Wrong raster→SVG conversion: ImageManager::getImage() tried to convert any uploaded image (PNG, JPEG) to SVG when imagick had SVG support. Imagick reliably fails writing raster→SVG, throwing an ImagickException that silently fell through to the next bug.
  • Wrong MIME type: ThemingController::getImage() switched from the config-stored MIME type to $file->getMimeType(). The original stored file has no extension (named logo, not logo.png), so detectPath() returned application/octet-stream, causing browsers to not render it as an image.
  • Stale SVG cache not cleaned on upload: ImageManager::delete() removed logo and logo.png but not logo.svg, so any cached SVG conversion persisted after a new image was uploaded.

The workaround of removing libmagickcore-6.q16-6-extra (disabling imagick SVG support) worked because it forced $useSvg=false, bypassing the broken SVG path and ending up in the PNG conversion path — which uses a properly-named logo.png file with a correct MIME type.

Fix

  • Removed the incorrect raster→SVG conversion. getImage() now only converts SVG originals to PNG when $useSvg=false (the original intended behaviour).
  • ThemingController::getImage() uses $file->getMimeType() for converted files (which have a .png/.svg extension), and falls back to the config-stored MIME type for the original extensionless file.
  • ImageManager::delete() now also deletes the .svg cached variant.

Test plan

  • Upload a PNG logo at /settings/admin/theming — logo should appear correctly
  • Upload a JPEG background — background should appear correctly
  • Upload an SVG logo — logo should appear correctly
  • Re-upload an image — the new image should replace the old one (no stale cache)
  • Unit tests pass: NOCOVERAGE=1 ./autotest.sh sqlite apps/theming/tests/ImageManagerTest.php and NOCOVERAGE=1 ./autotest.sh sqlite apps/theming/tests/Controller/ThemingControllerTest.php

🤖 Generated with Claude Code

@miaulalala miaulalala requested a review from a team as a code owner May 6, 2026 21:35
@miaulalala miaulalala requested review from leftybournes, nfebe, provokateurin and sorbaugh and removed request for a team May 6, 2026 21:35
miaulalala added 2 commits May 6, 2026 23:42
Three bugs were introduced by the backport of #55132 (PR #58224):

1. ImageManager::getImage() incorrectly tried to convert any uploaded
   raster image (PNG, JPEG) to SVG when imagick SVG support was available.
   Imagick can read SVGs but reliably fails writing raster→SVG, causing
   an ImagickException that silently fell through to bug 2.

2. ThemingController::getImage() changed Content-Type from the config-
   stored MIME to $file->getMimeType(). The original stored file has no
   extension (named "logo", not "logo.png"), so detectPath() returned
   application/octet-stream, causing browsers to not render the image.

3. ImageManager::delete() cleaned up logo and logo.png but not logo.svg,
   leaving stale SVG conversions that would be served after image updates.

Fixes #60146

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
Replace two deprecated IConfig::getAppValue() calls in ThemingController
with IAppConfig::getAppValueString():

- getImage(): MIME type lookup for the original extensionless stored file
- getManifest(): cachebuster value lookup

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the fix/noid/theming-broken-images-32-0-9 branch from d12c01c to 036d52a Compare May 6, 2026 21:43
The deprecated IConfig::getAppValue() calls in ThemingController have
been replaced with IAppConfig::getAppValueString(), so the baseline
suppression entry is no longer needed.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Theming broken in 32.0.9

1 participant