Skip to content

[stable32] fix(theming): fix broken custom images introduced by #58224#60233

Draft
backportbot[bot] wants to merge 3 commits intostable32from
backport/60198/stable32
Draft

[stable32] fix(theming): fix broken custom images introduced by #58224#60233
backportbot[bot] wants to merge 3 commits intostable32from
backport/60198/stable32

Conversation

@backportbot
Copy link
Copy Markdown

@backportbot backportbot Bot commented May 8, 2026

Backport of #60198

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Remove all the empty commits

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

miaulalala added 3 commits May 8, 2026 10:40
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>
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.

1 participant