[Bug]: occ theming:config <imageKey>` reads from wrong storage key
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
occ theming:config <imageKey> (where <imageKey> is background, logo,
logoheader, or favicon) always reports "is currently not set" even when
the value IS set and the UI serves it correctly. The read-back code reads
from theming.<key> but image values are stored at theming.<key>Mime.
Fix is 9 lines in apps/theming/lib/Command/UpdateConfig.php (around
line 84). Display value is the MIME type, matching the existing set-path
echo convention.
Bug present since **NC 21.0.0** (commit
[`9b7bdfef79c8`](https://github.com/nextcloud/server/commit/9b7bdfef79c8))
Potential Patch
diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php
index 6236f8664456..f10aaee0d0b3 100644
--- a/apps/theming/lib/Command/UpdateConfig.php
+++ b/apps/theming/lib/Command/UpdateConfig.php
@@ -82,7 +82,15 @@ class UpdateConfig extends Command {
}
if ($value === null) {
- $value = $this->config->getAppValue('theming', $key, '');
+ // Image-type keys (background, logo, logoheader, favicon) are stored
+ // at "<key>Mime" in app config — same convention the list-all branch
+ // above and ImageManager::getImage() use. Without this remap, the
+ // single-key read always returns '' for image keys regardless of
+ // whether one is set.
+ $storageKey = in_array($key, ImageManager::SUPPORTED_IMAGE_KEYS, true)
+ ? $key . 'Mime'
+ : $key;
+ $value = $this->config->getAppValue('theming', $storageKey, '');
if ($value !== '') {
$output->writeln('<info>' . $key . ' is currently set to ' . $value . '</info>');
} else {
Steps to reproduce
-
On a fresh Nextcloud 33.0.3 instance, set a logo via the admin Theming
UI or OCC:occ theming:config logo /path/to/logo.png # → "Updated logoMime to image/png" -
Confirm the logo is being served — visit the NC web UI; the custom logo
appears in the header. -
Read the value back via OCC:
occ theming:config logo
Expected behavior
logo is currently set to image/png (or whatever MIME type was uploaded).
I would suggest returning the URL with v=tag would be more useful but for consistency this seems like the expectation
Nextcloud Server version
33
Present since v21
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/theming/lib/Command/UpdateConfig.php around line 84 and compare the single-key read with the list-all branch and ImageManager::getImage(), which use the image MIME storage convention. Reproduce the issue with occ theming:config logo after setting a logo, then confirm the read reports the stored MIME type such as image/png.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100