Skip to content

refactor(preview): align provider lookup in PreviewManager checks#61629

Open
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-PreviewManager-providerOrdering
Open

refactor(preview): align provider lookup in PreviewManager checks#61629
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-PreviewManager-providerOrdering

Conversation

@joshtrichards

Copy link
Copy Markdown
Member

Summary

This refactor makes preview provider support and availability checks follow the same provider-loading path as preview generation instead of reading partially initialized provider state directly.

Why

getProviders() registers core and bootstrap providers and applies provider ordering. Preview generation already resolves providers through getProviders(), but isMimeSupported() and isAvailable() currently inspect $this->providers directly after partial setup.

This means support and availability checks do not use the same provider-loading and ordering path as preview generation, and isAvailable() also currently relies on isMimeSupported() side effects to register bootstrap providers before iterating providers.

This PR:

  • uses PreviewManager::getProviders() as the shared provider-loading path
  • switches isMimeSupported() to inspect the provider set returned by getProviders()
  • switches isAvailable() to iterate providers via getProviders()
  • removes the now-redundant direct provider registration calls in isMimeSupported() and isAvailable()

This does not change provider registration rules, MIME regexes, or preview generation logic.

In edge cases, this should also reduce the risk of preview capability checks disagreeing with the provider set ultimately used for generation.

It also prepares the code for follow-up refactors (e.g. further centralization of provider matching / traversal logic shared between PreviewManager and Generator).

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…y checks

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 35 milestone Jun 27, 2026
@joshtrichards joshtrichards requested a review from a team as a code owner June 27, 2026 15:30
@joshtrichards joshtrichards requested review from Altahrim and removed request for a team June 27, 2026 15:30
@joshtrichards joshtrichards added the ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) label Jun 27, 2026
@susnux susnux added the community pull requests from community label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews community pull requests from community feature: previews and thumbnails ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants