fix(theming): fix broken custom images introduced by #58224#60198
fix(theming): fix broken custom images introduced by #58224#60198miaulalala merged 4 commits intomasterfrom
Conversation
d12c01c to
036d52a
Compare
7638aca to
7954c0e
Compare
|
Nice! SVGs now work just fine. There's one small problem. The image thumbnail next to the button is only updated the first time an image is uploaded. Sequence:
Kooha-2026-05-07-10-30-54.webm |
Addressed - can you test again? |
|
Thanks! It is slightly different now. The thumbnail is only updated if no image was set before. Oh wait (like models say), if an SVG image is currently set and I upload a PNG or a JPEG, the thumbnail updates. It seems like if the type of the new image is different than the current one, it works. But if uploading something of the same type of what's currently set, nope. |
cache buster issue. should be fixed now. |
|
All good! 🚀 💥 |
|
/backport to stable33 |
|
/backport to stable32 |
a638734 to
b4f19b6
Compare
|
/compile amend |
b4f19b6 to
5a1da4b
Compare
4d5bdaa to
c1c23eb
Compare
|
/compile amend |
c1c23eb to
fb543b8
Compare
PR #58224 introduced a raster→SVG conversion path in ImageManager::getImage() that breaks display of custom theming images. The root cause is a three-part bug chain: 1. getImage() attempted to convert raster images (PNG/JPEG) to SVG format, which Imagick cannot do meaningfully and produces broken output. 2. getMimeType() returns 'application/octet-stream' for extensionless stored files, so the Content-Type response header was wrong. 3. Stale .svg cache files persisted after image replacement, causing subsequent requests to serve the wrong format. Fix by: - Restricting the Imagick conversion to SVG→PNG only (not raster→SVG) - Reading the stored MIME type from IAppConfig for extensionless files in ThemingController::getImage() - Deleting .svg cache files in ImageManager::delete() - Injecting IAppConfig into ImageManager and reading the cachebuster via IAppConfig::getAppValueInt() so the URL returned after upload always carries the freshly-incremented value (IConfig::getAppValue() can return a stale cached value within the same request) - Updating the FileInputField Vue component to use a reactive cacheKey ref that increments on every upload, so the thumbnail refreshes even when the MIME type of the new image is the same as the old one AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
- ImageManagerTest: inject IAppConfig mock, switch cachebuster assertions from IConfig::getAppValue to IAppConfig::getAppValueInt, add testGetImageSvgToSvg and testGetImageSvgToPng, update mockGetImage to reflect the corrected getImage() logic - ThemingControllerTest: update getImage and getManifest tests to use IAppConfig::getAppValueString for MIME type and cachebuster lookups, add testGetLogoOriginalFile for the extensionless-file MIME path AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
- Remove stale ThemingController entry (deprecated IConfig::getAppValue calls replaced with IAppConfig::getAppValueString) - Add CommentsEventListener::getEvent() (pre-existing deprecated usage not previously baselined) AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
New Transifex translation files landed in apps/appstore/l10n/ without a matching annotation block, causing the REUSE compliance check to fail. AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
fb543b8 to
6404d75
Compare
Summary
Fixes #60146 — custom theming images (logo, background, favicon, header logo) stopped displaying after upgrading to 32.0.9.
Root cause (three-part bug chain introduced by #58224)
ImageManager::getImage()attempted to convert raster images (PNG/JPEG) to SVG using Imagick, which cannot do this meaningfully and produces broken output.ThemingController::getImage()calledgetMimeType()on the stored file, but stored files have no extension, so Imagick/fileinfo returnsapplication/octet-stream. TheContent-Typeheader was therefore wrong, causing browsers to reject the image..svgcache files persisted after an image was replaced, so subsequent requests served the wrong format.Why disabling
libmagickcore-6.q16-6-extraappeared to fix itWithout SVG support,
canConvert('SVG')returnsfalse, skipping the broken conversion path entirely and falling back to returning the original file with its correct MIME type.Fixes
IAppConfigfor extensionless files inThemingController::getImage().svgcache files inImageManager::delete()IAppConfigintoImageManagerand read the cachebuster viaIAppConfig::getAppValueInt()—IConfig::getAppValue()can return a stale cached value within the same request, causing the URL returned after upload to carry the old buster valueFileInputField.vuethumbnail not refreshing on second consecutive upload of the same MIME type: thebackgroundcomputed property only reacted tomime.value, so uploading PNG→PNG left the thumbnail stale. A reactivecacheKeyref now increments on every successful upload.Test plan
libmagickcore-6.q16-6-extrainstalled (SVG support enabled)🤖 Generated with Claude Code