nextcloud / nextcloud/server

Read the MIME icon cache buster from initial state before Theming global assignment

Open Beginner friendly
#64,113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 33-feedback bug feature: dashboard feature: files feature: theming needs info
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Repository: https://github.com/nextcloud/server

core/src/OC/mimeType.js reads window.OCA.Theming.cacheBuster in getIconUrl. This throws when valid theming/data initial state is present but the additional OCA.Theming assignment has not happened or the OCA namespace has been replaced. Recommendations calls this method when initializing RecommendedFile.

The affected source is byte-identical in Nextcloud v33.0.6, v33.0.8 and stable33 revision cf340916779182c899e2e9d5bfebcaff5dfc6058.

Reproduction: provide valid initial state theming/data with {cacheBuster: 73}, normal OC MIME/theme configuration and window.OCA = {}; call getIconUrl('text/plain'). The global property lookup throws even though the needed state exists. The same occurs after replacing OCA or removing it. These reproduce the unsafe dependency; the exact scheduling of the original browser incident was not recorded.

Proposed change:

+import { loadState } from '@nextcloud/initial-state'
 ...
-path += '?v=' + window.OCA.Theming.cacheBuster
+path += '?v=' + loadState('theming', 'data').cacheBuster

This uses the state object already read by apps/theming/src/theming.ts, including its shared cache identity. There is no default cache-buster and missing or malformed initial state remains an error.

Validation: 13 extracted-source cases, with three failures before and all 13 passing after. Coverage includes MIME aliases, older theme paths, unknown MIME types, cache-buster zero, cached URLs, cache clearing, later updates through the shared state object and malformed/missing state. The matching diagnostic bundle passed the same cases. A local Chromium comparison with this and two independent app corrections passed all navigation checks; a full rebuilt release remains untested.

This is a JavaScript initialization issue, distinct from the server-side AppConfig cache-buster integer/string mismatch reports for Nextcloud 34.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/src/OC/mimeType.js at getIconUrl and inspect how the theming cache buster is read. Reproduce with valid theming/data initial state and window.OCA = {}, then validate the 13 described cases, including aliases, cached URLs, cache clearing, updates, and malformed or missing state; done means all cases pass without relying on the OCA namespace.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.